We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
prev_balances
LastApprove.new_state
1 parent 7d8800e commit 6fa6fb3Copy full SHA for 6fa6fb3
validator_worker/src/follower.rs
@@ -85,8 +85,11 @@ async fn on_new_state<'a, A: Adapter + 'static>(
85
}
86
87
let last_approve_response = await!(iface.get_last_approved())?;
88
- // TODO: Check if it's possible to have an empty response (i.e. we don't have LastApprove)
89
- let prev_balances = last_approve_response.last_approved.new_state.balances;
+ let prev_balances = last_approve_response
+ .last_approved
90
+ .new_state
91
+ .map(|new_state| new_state.balances)
92
+ .unwrap_or_else(Default::default);
93
if !is_valid_transition(&iface.channel, &prev_balances, &proposed_balances) {
94
return Ok(await!(on_error(
95
&iface,
0 commit comments