@@ -1509,8 +1509,8 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitor<Signer> {
1509
1509
fn provide_latest_holder_commitment_tx (
1510
1510
& self , holder_commitment_tx : HolderCommitmentTransaction ,
1511
1511
htlc_outputs : Vec < ( HTLCOutputInCommitment , Option < Signature > , Option < HTLCSource > ) > ,
1512
- ) -> Result < ( ) , ( ) > {
1513
- self . inner . lock ( ) . unwrap ( ) . provide_latest_holder_commitment_tx ( holder_commitment_tx, htlc_outputs, & Vec :: new ( ) , Vec :: new ( ) ) . map_err ( |_| ( ) )
1512
+ ) {
1513
+ self . inner . lock ( ) . unwrap ( ) . provide_latest_holder_commitment_tx ( holder_commitment_tx, htlc_outputs, & Vec :: new ( ) , Vec :: new ( ) )
1514
1514
}
1515
1515
1516
1516
/// This is used to provide payment preimage(s) out-of-band during startup without updating the
@@ -2901,7 +2901,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
2901
2901
/// is important that any clones of this channel monitor (including remote clones) by kept
2902
2902
/// up-to-date as our holder commitment transaction is updated.
2903
2903
/// Panics if set_on_holder_tx_csv has never been called.
2904
- 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 > {
2904
+ 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 > ) {
2905
2905
if htlc_outputs. iter ( ) . any ( |( _, s, _) | s. is_some ( ) ) {
2906
2906
// If we have non-dust HTLCs in htlc_outputs, ensure they match the HTLCs in the
2907
2907
// `holder_commitment_tx`. In the future, we'll no longer provide the redundant data
@@ -2978,10 +2978,6 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
2978
2978
}
2979
2979
self . counterparty_fulfilled_htlcs . insert ( * claimed_htlc_id, * claimed_preimage) ;
2980
2980
}
2981
- if self . holder_tx_signed {
2982
- return Err ( "Latest holder commitment signed has already been signed, update is rejected" ) ;
2983
- }
2984
- Ok ( ( ) )
2985
2981
}
2986
2982
2987
2983
/// Provides a payment_hash->payment_preimage mapping. Will be automatically pruned when all
@@ -3202,11 +3198,7 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
3202
3198
ChannelMonitorUpdateStep :: LatestHolderCommitmentTXInfo { commitment_tx, htlc_outputs, claimed_htlcs, nondust_htlc_sources } => {
3203
3199
log_trace ! ( logger, "Updating ChannelMonitor with latest holder commitment transaction info" ) ;
3204
3200
if self . lockdown_from_offchain { panic ! ( ) ; }
3205
- if let Err ( e) = self . provide_latest_holder_commitment_tx ( commitment_tx. clone ( ) , htlc_outputs. clone ( ) , & claimed_htlcs, nondust_htlc_sources. clone ( ) ) {
3206
- log_error ! ( logger, "Providing latest holder commitment transaction failed/was refused:" ) ;
3207
- log_error ! ( logger, " {}" , e) ;
3208
- ret = Err ( ( ) ) ;
3209
- }
3201
+ self . provide_latest_holder_commitment_tx ( commitment_tx. clone ( ) , htlc_outputs. clone ( ) , & claimed_htlcs, nondust_htlc_sources. clone ( ) ) ;
3210
3202
}
3211
3203
ChannelMonitorUpdateStep :: LatestCounterpartyCommitmentTXInfo { commitment_txid, htlc_outputs, commitment_number, their_per_commitment_point, .. } => {
3212
3204
log_trace ! ( logger, "Updating ChannelMonitor with latest counterparty commitment transaction info" ) ;
@@ -5386,7 +5378,7 @@ mod tests {
5386
5378
let dummy_commitment_tx = HolderCommitmentTransaction :: dummy ( & mut htlcs) ;
5387
5379
5388
5380
monitor. provide_latest_holder_commitment_tx ( dummy_commitment_tx. clone ( ) ,
5389
- htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) . unwrap ( ) ;
5381
+ htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) ;
5390
5382
monitor. provide_latest_counterparty_commitment_tx ( Txid :: from_byte_array ( Sha256 :: hash ( b"1" ) . to_byte_array ( ) ) ,
5391
5383
preimages_slice_to_htlc_outputs ! ( preimages[ 5 ..15 ] ) , 281474976710655 , dummy_key, & logger) ;
5392
5384
monitor. provide_latest_counterparty_commitment_tx ( Txid :: from_byte_array ( Sha256 :: hash ( b"2" ) . to_byte_array ( ) ) ,
@@ -5424,7 +5416,7 @@ mod tests {
5424
5416
let mut htlcs = preimages_slice_to_htlcs ! ( preimages[ 0 ..5 ] ) ;
5425
5417
let dummy_commitment_tx = HolderCommitmentTransaction :: dummy ( & mut htlcs) ;
5426
5418
monitor. provide_latest_holder_commitment_tx ( dummy_commitment_tx. clone ( ) ,
5427
- htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) . unwrap ( ) ;
5419
+ htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) ;
5428
5420
secret[ 0 ..32 ] . clone_from_slice ( & <Vec < u8 > >:: from_hex ( "2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8" ) . unwrap ( ) ) ;
5429
5421
monitor. provide_secret ( 281474976710653 , secret. clone ( ) ) . unwrap ( ) ;
5430
5422
assert_eq ! ( monitor. inner. lock( ) . unwrap( ) . payment_preimages. len( ) , 12 ) ;
@@ -5435,7 +5427,7 @@ mod tests {
5435
5427
let mut htlcs = preimages_slice_to_htlcs ! ( preimages[ 0 ..3 ] ) ;
5436
5428
let dummy_commitment_tx = HolderCommitmentTransaction :: dummy ( & mut htlcs) ;
5437
5429
monitor. provide_latest_holder_commitment_tx ( dummy_commitment_tx,
5438
- htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) . unwrap ( ) ;
5430
+ htlcs. into_iter ( ) . map ( |( htlc, _) | ( htlc, Some ( dummy_sig) , None ) ) . collect ( ) ) ;
5439
5431
secret[ 0 ..32 ] . clone_from_slice ( & <Vec < u8 > >:: from_hex ( "27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116" ) . unwrap ( ) ) ;
5440
5432
monitor. provide_secret ( 281474976710652 , secret. clone ( ) ) . unwrap ( ) ;
5441
5433
assert_eq ! ( monitor. inner. lock( ) . unwrap( ) . payment_preimages. len( ) , 5 ) ;
0 commit comments