@@ -1536,8 +1536,8 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
1536
1536
fn provide_latest_holder_commitment_tx (
1537
1537
& self , holder_commitment_tx : HolderCommitmentTransaction ,
1538
1538
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 ( ) )
1541
1541
}
1542
1542
1543
1543
/// 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> {
2938
2938
/// is important that any clones of this channel monitor (including remote clones) by kept
2939
2939
/// up-to-date as our holder commitment transaction is updated.
2940
2940
/// 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 > ) {
2942
2942
if htlc_outputs. iter ( ) . any ( |( _, s, _) | s. is_some ( ) ) {
2943
2943
// If we have non-dust HTLCs in htlc_outputs, ensure they match the HTLCs in the
2944
2944
// `holder_commitment_tx`. In the future, we'll no longer provide the redundant data
@@ -3015,10 +3015,6 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3015
3015
}
3016
3016
self . counterparty_fulfilled_htlcs . insert ( * claimed_htlc_id, * claimed_preimage) ;
3017
3017
}
3018
- if self . holder_tx_signed {
3019
- return Err ( "Latest holder commitment signed has already been signed, update is rejected" ) ;
3020
- }
3021
- Ok ( ( ) )
3022
3018
}
3023
3019
3024
3020
/// Provides a payment_hash->payment_preimage mapping. Will be automatically pruned when all
@@ -3239,11 +3235,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3239
3235
ChannelMonitorUpdateStep :: LatestHolderCommitmentTXInfo { commitment_tx, htlc_outputs, claimed_htlcs, nondust_htlc_sources } => {
3240
3236
log_trace ! ( logger, "Updating ChannelMonitor with latest holder commitment transaction info" ) ;
3241
3237
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 ( ) ) ;
3247
3239
}
3248
3240
ChannelMonitorUpdateStep :: LatestCounterpartyCommitmentTXInfo { commitment_txid, htlc_outputs, commitment_number, their_per_commitment_point, .. } => {
3249
3241
log_trace ! ( logger, "Updating ChannelMonitor with latest counterparty commitment transaction info" ) ;
@@ -5434,7 +5426,7 @@ mod tests {
5434
5426
let dummy_commitment_tx = HolderCommitmentTransaction :: dummy ( & mut htlcs) ;
5435
5427
5436
5428
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 ( ) ) ;
5438
5430
monitor. provide_latest_counterparty_commitment_tx ( Txid :: from_byte_array ( Sha256 :: hash ( b"1" ) . to_byte_array ( ) ) ,
5439
5431
preimages_slice_to_htlc_outputs ! ( preimages[ 5 ..15 ] ) , 281474976710655 , dummy_key, & logger) ;
5440
5432
monitor. provide_latest_counterparty_commitment_tx ( Txid :: from_byte_array ( Sha256 :: hash ( b"2" ) . to_byte_array ( ) ) ,
@@ -5472,7 +5464,7 @@ mod tests {
5472
5464
let mut htlcs = preimages_slice_to_htlcs ! ( preimages[ 0 ..5 ] ) ;
5473
5465
let dummy_commitment_tx = HolderCommitmentTransaction :: dummy ( & mut htlcs) ;
5474
5466
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 ( ) ) ;
5476
5468
secret[ 0 ..32 ] . clone_from_slice ( & <Vec < u8 > >:: from_hex ( "2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8" ) . unwrap ( ) ) ;
5477
5469
monitor. provide_secret ( 281474976710653 , secret. clone ( ) ) . unwrap ( ) ;
5478
5470
assert_eq ! ( monitor. inner. lock( ) . unwrap( ) . payment_preimages. len( ) , 12 ) ;
@@ -5483,7 +5475,7 @@ mod tests {
5483
5475
let mut htlcs = preimages_slice_to_htlcs ! ( preimages[ 0 ..3 ] ) ;
5484
5476
let dummy_commitment_tx = HolderCommitmentTransaction :: dummy ( & mut htlcs) ;
5485
5477
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 ( ) ) ;
5487
5479
secret[ 0 ..32 ] . clone_from_slice ( & <Vec < u8 > >:: from_hex ( "27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116" ) . unwrap ( ) ) ;
5488
5480
monitor. provide_secret ( 281474976710652 , secret. clone ( ) ) . unwrap ( ) ;
5489
5481
assert_eq ! ( monitor. inner. lock( ) . unwrap( ) . payment_preimages. len( ) , 5 ) ;
0 commit comments