File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Expand file tree Collapse file tree 2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ pub struct ChannelAllResponse {
70
70
#[ derive( Serialize , Deserialize , Debug ) ]
71
71
#[ serde( rename_all = "camelCase" ) ]
72
72
pub struct LastApprovedResponse {
73
- pub last_approved : LastApproved ,
73
+ pub last_approved : Option < LastApproved > ,
74
74
pub heartbeats : Option < Vec < Heartbeat > > ,
75
75
}
76
76
Original file line number Diff line number Diff line change @@ -87,9 +87,9 @@ async fn on_new_state<'a, A: Adapter + 'static>(
87
87
let last_approve_response = await ! ( iface. get_last_approved( ) ) ?;
88
88
let prev_balances = last_approve_response
89
89
. last_approved
90
- . new_state
91
- . map ( |new_state| new_state. balances )
92
- . unwrap_or_else ( Default :: default ) ;
90
+ . and_then ( |last_approved| last_approved . new_state )
91
+ . map_or ( Default :: default ( ) , |new_state| new_state. balances ) ;
92
+
93
93
if !is_valid_transition ( & iface. channel , & prev_balances, & proposed_balances) {
94
94
return Ok ( await ! ( on_error(
95
95
& iface,
@@ -134,7 +134,6 @@ async fn on_error<'a, A: Adapter + 'static>(
134
134
signature : new_state. signature . clone ( ) ,
135
135
balances : Some ( new_state. balances . clone ( ) ) ,
136
136
/// The NewState timestamp that is being rejected
137
- // TODO: Double check this, if we decide to have 2 timestamps - 1 for the RejectState & 1 for NewState timestamp
138
137
timestamp : Some ( Utc :: now ( ) ) ,
139
138
} ) ] ) ;
140
139
You can’t perform that action at this time.
0 commit comments