@@ -1536,8 +1536,8 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
15361536 fn provide_latest_holder_commitment_tx (
15371537 & self , holder_commitment_tx : HolderCommitmentTransaction ,
15381538 htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > ,
1539- ) -> Result < ( ) , ( ) > {
1540- self . inner . lock ( ) . unwrap ( ) . provide_latest_holder_commitment_tx ( holder_commitment_tx, htlc_outputs, & Vec :: new ( ) , Vec :: new ( ) ) . map_err ( |_| ( ) )
1539+ ) {
1540+ self . inner . lock ( ) . unwrap ( ) . provide_latest_holder_commitment_tx ( holder_commitment_tx, htlc_outputs, & Vec :: new ( ) , Vec :: new ( ) )
15411541 }
15421542
15431543 /// This is used to provide payment preimage(s) out-of-band during startup without updating the
@@ -2938,7 +2938,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
29382938 /// is important that any clones of this channel monitor (including remote clones) by kept
29392939 /// up-to-date as our holder commitment transaction is updated.
29402940 /// Panics if set_on_holder_tx_csv has never been called.
2941- fn provide_latest_holder_commitment_tx ( & mut self , holder_commitment_tx : HolderCommitmentTransaction , mut htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > , claimed_htlcs : & [ ( SentHTLCId , PaymentPreimage ) ] , nondust_htlc_sources : Vec < HTLCSource > ) -> Result < ( ) , & ' static str > {
2941+ fn provide_latest_holder_commitment_tx ( & mut self , holder_commitment_tx : HolderCommitmentTransaction , mut htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > , claimed_htlcs : & [ ( SentHTLCId , PaymentPreimage ) ] , nondust_htlc_sources : Vec < HTLCSource > ) {
29422942 if htlc_outputs. iter ( ) . any ( |( _, s, _) | s. is_some ( ) ) {
29432943 // If we have non-dust HTLCs in htlc_outputs, ensure they match the HTLCs in the
29442944 // `holder_commitment_tx`. In the future, we'll no longer provide the redundant data
@@ -3015,10 +3015,6 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
30153015 }
30163016 self . counterparty_fulfilled_htlcs . insert ( * claimed_htlc_id, * claimed_preimage) ;
30173017 }
3018- if self . holder_tx_signed {
3019- return Err ( "Latest holder commitment signed has already been signed, update is rejected" ) ;
3020- }
3021- Ok ( ( ) )
30223018 }
30233019
30243020 /// Provides a payment_hash->payment_preimage mapping. Will be automatically pruned when all
@@ -3239,11 +3235,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
32393235 ChannelMonitorUpdateStep :: LatestHolderCommitmentTXInfo { commitment_tx, htlc_outputs, claimed_htlcs, nondust_htlc_sources } => {
32403236 log_trace ! ( logger, "Updating ChannelMonitor with latest holder commitment transaction info" ) ;
32413237 if self . lockdown_from_offchain { panic ! ( ) ; }
3242- if let Err ( e) = self . provide_latest_holder_commitment_tx ( commitment_tx. clone ( ) , htlc_outputs. clone ( ) , & claimed_htlcs, nondust_htlc_sources. clone ( ) ) {
3243- log_error ! ( logger, "Providing latest holder commitment transaction failed/was refused:" ) ;
3244- log_error ! ( logger, " {}" , e) ;
3245- ret = Err ( ( ) ) ;
3246- }
3238+ self . provide_latest_holder_commitment_tx ( commitment_tx. clone ( ) , htlc_outputs. clone ( ) , & claimed_htlcs, nondust_htlc_sources. clone ( ) ) ;
32473239 }
32483240 ChannelMonitorUpdateStep :: LatestCounterpartyCommitmentTXInfo { commitment_txid, htlc_outputs, commitment_number, their_per_commitment_point, .. } => {
32493241 log_trace ! ( logger, "Updating ChannelMonitor with latest counterparty commitment transaction info" ) ;
@@ -5434,7 +5426,7 @@ mod tests {
54345426 let dummy_commitment_tx = HolderCommitmentTransaction :: dummy ( & mut htlcs) ;
54355427
54365428 monitor. provide_latest_holder_commitment_tx ( dummy_commitment_tx. clone ( ) ,
5437- htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) . unwrap ( ) ;
5429+ htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) ;
54385430 monitor. provide_latest_counterparty_commitment_tx ( Txid :: from_byte_array ( Sha256 :: hash ( b"1" ) . to_byte_array ( ) ) ,
54395431 preimages_slice_to_htlc_outputs ! ( preimages[ 5 ..15 ] ) , 281474976710655 , dummy_key, & logger) ;
54405432 monitor. provide_latest_counterparty_commitment_tx ( Txid :: from_byte_array ( Sha256 :: hash ( b"2" ) . to_byte_array ( ) ) ,
@@ -5472,7 +5464,7 @@ mod tests {
54725464 let mut htlcs = preimages_slice_to_htlcs ! ( preimages[ 0 ..5 ] ) ;
54735465 let dummy_commitment_tx = HolderCommitmentTransaction :: dummy ( & mut htlcs) ;
54745466 monitor. provide_latest_holder_commitment_tx ( dummy_commitment_tx. clone ( ) ,
5475- htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) . unwrap ( ) ;
5467+ htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) ;
54765468 secret[ 0 ..32 ] . clone_from_slice ( & <Vec < u8 > >:: from_hex ( "2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8" ) . unwrap ( ) ) ;
54775469 monitor. provide_secret ( 281474976710653 , secret. clone ( ) ) . unwrap ( ) ;
54785470 assert_eq ! ( monitor. inner. lock( ) . unwrap( ) . payment_preimages. len( ) , 12 ) ;
@@ -5483,7 +5475,7 @@ mod tests {
54835475 let mut htlcs = preimages_slice_to_htlcs ! ( preimages[ 0 ..3 ] ) ;
54845476 let dummy_commitment_tx = HolderCommitmentTransaction :: dummy ( & mut htlcs) ;
54855477 monitor. provide_latest_holder_commitment_tx ( dummy_commitment_tx,
5486- htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) . unwrap ( ) ;
5478+ htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) ;
54875479 secret[ 0 ..32 ] . clone_from_slice ( & <Vec < u8 > >:: from_hex ( "27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116" ) . unwrap ( ) ) ;
54885480 monitor. provide_secret ( 281474976710652 , secret. clone ( ) ) . unwrap ( ) ;
54895481 assert_eq ! ( monitor. inner. lock( ) . unwrap( ) . payment_preimages. len( ) , 5 ) ;
0 commit comments