You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove remaining uses of HandleError in Channel Err return values
This converts block_connected failures to returning the
ErrorMessage that needs to be sent directly, since it always
results in channel closure and never results in needing to call
force_shutdown. It also converts update_add_htlc and closing_signed
handlers to ChannelError as the rest of the message handlers.
returnErr(HandleError{err:"Peer sent update_add_htlc when we needed a channel_reestablish",action:Some(msgs::ErrorAction::SendErrorMessage{msg: msgs::ErrorMessage{data:"Peer sent update_add_htlc when we needed a channel_reestablish".to_string(),channel_id: msg.channel_id}})});
1527
+
returnErr(ChannelError::Close("Peer sent update_add_htlc when we needed a channel_reestablish"));
1537
1528
}
1538
1529
if msg.amount_msat > self.channel_value_satoshis*1000{
1539
-
returnErr(HandleError{err:"Remote side tried to send more than the total value of the channel",action:None});
1530
+
returnErr(ChannelError::Close("Remote side tried to send more than the total value of the channel"));
1540
1531
}
1541
1532
if msg.amount_msat < self.our_htlc_minimum_msat{
1542
-
returnErr(HandleError{err:"Remote side tried to send less than our minimum HTLC value",action:None});
1533
+
returnErr(ChannelError::Close("Remote side tried to send less than our minimum HTLC value"));
returnErr(HandleError{err:"Peer sent closing_signed when we needed a channel_reestablish",action:Some(msgs::ErrorAction::SendErrorMessage{msg: msgs::ErrorMessage{data:"Peer sent closing_signed when we needed a channel_reestablish".to_string(),channel_id: msg.channel_id}})});
2507
+
returnErr(ChannelError::Close("Peer sent closing_signed when we needed a channel_reestablish"));
2517
2508
}
2518
2509
if !self.pending_inbound_htlcs.is_empty() || !self.pending_outbound_htlcs.is_empty(){
2519
-
returnErr(HandleError{err:"Remote end sent us a closing_signed while there were still pending HTLCs",action:None});
2510
+
returnErr(ChannelError::Close("Remote end sent us a closing_signed while there were still pending HTLCs"));
2520
2511
}
2521
2512
if msg.fee_satoshis > 21000000*10000000{//this is required to stop potential overflow in build_closing_transaction
2522
-
returnErr(HandleError{err:"Remote tried to send us a closing tx with > 21 million BTC fee",action:None});
2513
+
returnErr(ChannelError::Close("Remote tried to send us a closing tx with > 21 million BTC fee"));
2523
2514
}
2524
2515
2525
2516
let funding_redeemscript = self.get_funding_redeemscript();
returnErr(HandleError{err:"Unable to come to consensus about closing feerate, remote wanted something lower than our Background feerate",action:None});
2574
+
returnErr(ChannelError::Close("Unable to come to consensus about closing feerate, remote wanted something lower than our Background feerate"));
2584
2575
}
2585
2576
}
2586
2577
propose_new_feerate!(our_min_feerate);
@@ -2780,7 +2771,7 @@ impl Channel {
2780
2771
/// In case of Err, the channel may have been closed, at which point the standard requirements
2781
2772
/// apply - no calls may be made except those explicitly stated to be allowed post-shutdown.
2782
2773
/// Only returns an ErrorAction of DisconnectPeer, if Err.
0 commit comments