@@ -1094,7 +1094,7 @@ impl Channel {
1094
1094
1095
1095
pub fn get_update_fail_htlc ( & mut self , payment_hash_arg : & [ u8 ; 32 ] , err_packet : msgs:: OnionErrorPacket ) -> Result < Option < msgs:: UpdateFailHTLC > , HandleError > {
1096
1096
if ( self . channel_state & ( ChannelState :: ChannelFunded as u32 ) ) != ( ChannelState :: ChannelFunded as u32 ) {
1097
- return Err ( HandleError { err : "Was asked to fail an HTLC when channel was not in an operational state" , action : None } ) ;
1097
+ panic ! ( "Was asked to fail an HTLC when channel was not in an operational state" ) ;
1098
1098
}
1099
1099
assert_eq ! ( self . channel_state & ChannelState :: ShutdownComplete as u32 , 0 ) ;
1100
1100
@@ -2390,12 +2390,13 @@ impl Channel {
2390
2390
/// Creates a signed commitment transaction to send to the remote peer.
2391
2391
/// Always returns a Channel-failing HandleError::action if an immediately-preceding (read: the
2392
2392
/// last call to this Channel) send_htlc returned Ok(Some(_)) and there is an Err.
2393
+ /// May panic if called except immediately after a successful, Ok(Some(_))-returning send_htlc.
2393
2394
pub fn send_commitment ( & mut self ) -> Result < ( msgs:: CommitmentSigned , ChannelMonitor ) , HandleError > {
2394
2395
if ( self . channel_state & ( ChannelState :: ChannelFunded as u32 ) ) != ( ChannelState :: ChannelFunded as u32 ) {
2395
- return Err ( HandleError { err : "Cannot create commitment tx until channel is fully established" , action : None } ) ;
2396
+ panic ! ( "Cannot create commitment tx until channel is fully established" ) ;
2396
2397
}
2397
2398
if ( self . channel_state & ( ChannelState :: AwaitingRemoteRevoke as u32 ) ) == ( ChannelState :: AwaitingRemoteRevoke as u32 ) {
2398
- return Err ( HandleError { err : "Cannot create commitment tx until remote revokes their previous commitment" , action : None } ) ;
2399
+ panic ! ( "Cannot create commitment tx until remote revokes their previous commitment" ) ;
2399
2400
}
2400
2401
let mut have_updates = false ; // TODO initialize with "have we sent a fee update?"
2401
2402
for htlc in self . pending_htlcs . iter ( ) {
@@ -2405,7 +2406,7 @@ impl Channel {
2405
2406
if have_updates { break ; }
2406
2407
}
2407
2408
if !have_updates {
2408
- return Err ( HandleError { err : "Cannot create commitment tx until we have some updates to send" , action : None } ) ;
2409
+ panic ! ( "Cannot create commitment tx until we have some updates to send" ) ;
2409
2410
}
2410
2411
self . send_commitment_no_status_check ( )
2411
2412
}
0 commit comments