@@ -361,10 +361,6 @@ enum OnchainEvent {
361
361
HTLCUpdate {
362
362
source : HTLCSource ,
363
363
payment_hash : PaymentHash ,
364
- /// If the HTLC was claimed by an HTLC-Timeout transaction (ie when the HTLC exists on
365
- /// chain), this is the amount of the output of that transaction (ie `htlc_value_satoshis`
366
- /// minus fees).
367
- onchain_value_satoshis : Option < u64 > ,
368
364
htlc_value_satoshis : Option < u64 > ,
369
365
/// None in the second case, above, ie when there is no relevant output in the commitment
370
366
/// transaction which appeared on chain.
@@ -396,10 +392,6 @@ enum OnchainEvent {
396
392
/// signature.
397
393
HTLCSpendConfirmation {
398
394
commitment_tx_output_idx : u32 ,
399
- /// If the HTLC was claimed by an HTLC-Success or HTLC-Timeout transaction (ie when the
400
- /// HTLC was not claimed via the revocation path), this is the amount of the output of that
401
- /// transaction (ie `htlc_value_satoshis` minus fees).
402
- onchain_value_satoshis : Option < u64 > ,
403
395
/// If the claim was made by either party with a preimage, this is filled in
404
396
preimage : Option < PaymentPreimage > ,
405
397
/// If the claim was made by us on an inbound HTLC against a local commitment transaction,
@@ -447,7 +439,6 @@ impl_writeable_tlv_based_enum_upgradable!(OnchainEvent,
447
439
( 1 , htlc_value_satoshis, option) ,
448
440
( 2 , payment_hash, required) ,
449
441
( 3 , commitment_tx_output_idx, option) ,
450
- ( 5 , onchain_value_satoshis, option) ,
451
442
} ,
452
443
( 1 , MaturingOutput ) => {
453
444
( 0 , descriptor, required) ,
@@ -458,7 +449,6 @@ impl_writeable_tlv_based_enum_upgradable!(OnchainEvent,
458
449
} ,
459
450
( 5 , HTLCSpendConfirmation ) => {
460
451
( 0 , commitment_tx_output_idx, required) ,
461
- ( 1 , onchain_value_satoshis, option) ,
462
452
( 2 , preimage, option) ,
463
453
( 4 , on_to_local_output_csv, option) ,
464
454
} ,
@@ -1744,7 +1734,6 @@ macro_rules! fail_unbroadcast_htlcs {
1744
1734
source: ( * * source) . clone( ) ,
1745
1735
payment_hash: htlc. payment_hash. clone( ) ,
1746
1736
htlc_value_satoshis: Some ( htlc. amount_msat / 1000 ) ,
1747
- onchain_value_satoshis: None ,
1748
1737
commitment_tx_output_idx: None ,
1749
1738
} ,
1750
1739
} ;
@@ -2677,7 +2666,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2677
2666
// Produce actionable events from on-chain events having reached their threshold.
2678
2667
for entry in onchain_events_reaching_threshold_conf. drain ( ..) {
2679
2668
match entry. event {
2680
- OnchainEvent :: HTLCUpdate { ref source, payment_hash, htlc_value_satoshis, commitment_tx_output_idx, .. } => {
2669
+ OnchainEvent :: HTLCUpdate { ref source, payment_hash, htlc_value_satoshis, commitment_tx_output_idx } => {
2681
2670
// Check for duplicate HTLC resolutions.
2682
2671
#[ cfg( debug_assertions) ]
2683
2672
{
@@ -2914,16 +2903,9 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2914
2903
let accepted_timeout_claim = witness_items == 3 && htlctype == Some ( HTLCType :: AcceptedHTLC ) && !revocation_sig_claim;
2915
2904
let offered_preimage_claim = witness_items == 3 && htlctype == Some ( HTLCType :: OfferedHTLC ) &&
2916
2905
!revocation_sig_claim && input. witness . second_to_last ( ) . unwrap ( ) . len ( ) == 32 ;
2917
- let offered_timeout_claim = witness_items == 5 && htlctype == Some ( HTLCType :: OfferedHTLC ) ;
2918
2906
2919
- let claim_via_htlc_tx = accepted_preimage_claim || offered_timeout_claim;
2920
- if claim_via_htlc_tx {
2921
- // If the claim was via an HTLC-Timeout/HTLC-Success transaction, it must be a
2922
- // 1-in-1-out transaction as its pre-signed.
2923
- // Note that if anchors are available these both may vary.
2924
- debug_assert_eq ! ( tx. input. len( ) , 1 ) ;
2925
- debug_assert_eq ! ( tx. output. len( ) , 1 ) ;
2926
- }
2907
+ #[ cfg( not( fuzzing) ) ]
2908
+ let offered_timeout_claim = witness_items == 5 && htlctype == Some ( HTLCType :: OfferedHTLC ) ;
2927
2909
2928
2910
let mut payment_preimage = PaymentPreimage ( [ 0 ; 32 ] ) ;
2929
2911
if accepted_preimage_claim {
@@ -2963,14 +2945,13 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2963
2945
}
2964
2946
2965
2947
macro_rules! check_htlc_valid_counterparty {
2966
- ( $counterparty_txid: expr, $htlc_output: expr, $htlc_value_sats : expr ) => {
2948
+ ( $counterparty_txid: expr, $htlc_output: expr) => {
2967
2949
if let Some ( txid) = $counterparty_txid {
2968
2950
for & ( ref pending_htlc, ref pending_source) in self . counterparty_claimable_outpoints. get( & txid) . unwrap( ) {
2969
2951
if pending_htlc. payment_hash == $htlc_output. payment_hash && pending_htlc. amount_msat == $htlc_output. amount_msat {
2970
2952
if let & Some ( ref source) = pending_source {
2971
2953
log_claim!( "revoked counterparty commitment tx" , false , pending_htlc, true ) ;
2972
- payment_data = Some ( ( ( * * source) . clone( ) , $htlc_output. payment_hash,
2973
- pending_htlc. amount_msat, $htlc_value_sats) ) ;
2954
+ payment_data = Some ( ( ( * * source) . clone( ) , $htlc_output. payment_hash, $htlc_output. amount_msat) ) ;
2974
2955
break ;
2975
2956
}
2976
2957
}
@@ -2983,24 +2964,18 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2983
2964
( $htlcs: expr, $tx_info: expr, $holder_tx: expr) => {
2984
2965
for ( ref htlc_output, source_option) in $htlcs {
2985
2966
if Some ( input. previous_output. vout) == htlc_output. transaction_output_index {
2986
- let htlc_value_sats = if claim_via_htlc_tx {
2987
- tx. output. iter( ) . map( |txout| txout. value) . sum:: <u64 >( )
2988
- } else { htlc_output. amount_msat / 1000 } ;
2989
2967
if let Some ( ref source) = source_option {
2990
2968
log_claim!( $tx_info, $holder_tx, htlc_output, true ) ;
2991
2969
// We have a resolution of an HTLC either from one of our latest
2992
2970
// holder commitment transactions or an unrevoked counterparty commitment
2993
2971
// transaction. This implies we either learned a preimage, the HTLC
2994
2972
// has timed out, or we screwed up. In any case, we should now
2995
2973
// resolve the source HTLC with the original sender.
2996
- payment_data = Some ( ( ( * source) . clone( ) , htlc_output. payment_hash,
2997
- htlc_output. amount_msat, htlc_value_sats) ) ;
2974
+ payment_data = Some ( ( ( * source) . clone( ) , htlc_output. payment_hash, htlc_output. amount_msat) ) ;
2998
2975
} else if !$holder_tx {
2999
- check_htlc_valid_counterparty!( self . current_counterparty_commitment_txid,
3000
- htlc_output, htlc_value_sats) ;
2976
+ check_htlc_valid_counterparty!( self . current_counterparty_commitment_txid, htlc_output) ;
3001
2977
if payment_data. is_none( ) {
3002
- check_htlc_valid_counterparty!( self . prev_counterparty_commitment_txid,
3003
- htlc_output, htlc_value_sats) ;
2978
+ check_htlc_valid_counterparty!( self . prev_counterparty_commitment_txid, htlc_output) ;
3004
2979
}
3005
2980
}
3006
2981
if payment_data. is_none( ) {
@@ -3011,7 +2986,6 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
3011
2986
txid: tx. txid( ) , height, transaction: Some ( tx. clone( ) ) ,
3012
2987
event: OnchainEvent :: HTLCSpendConfirmation {
3013
2988
commitment_tx_output_idx: input. previous_output. vout,
3014
- onchain_value_satoshis: Some ( htlc_value_sats) ,
3015
2989
preimage: if accepted_preimage_claim || offered_preimage_claim {
3016
2990
Some ( payment_preimage) } else { None } ,
3017
2991
// If this is a payment to us (!outbound_htlc, above),
@@ -3054,7 +3028,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
3054
3028
3055
3029
// Check that scan_commitment, above, decided there is some source worth relaying an
3056
3030
// HTLC resolution backwards to and figure out whether we learned a preimage from it.
3057
- if let Some ( ( source, payment_hash, amount_msat, onchain_amount_sat ) ) = payment_data {
3031
+ if let Some ( ( source, payment_hash, amount_msat) ) = payment_data {
3058
3032
if accepted_preimage_claim {
3059
3033
if !self . pending_monitor_events . iter ( ) . any (
3060
3034
|update| if let & MonitorEvent :: HTLCEvent ( ref upd) = update { upd. source == source } else { false } ) {
@@ -3066,7 +3040,6 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
3066
3040
commitment_tx_output_idx : input. previous_output . vout ,
3067
3041
preimage : Some ( payment_preimage) ,
3068
3042
on_to_local_output_csv : None ,
3069
- onchain_value_satoshis : Some ( onchain_amount_sat) ,
3070
3043
} ,
3071
3044
} ) ;
3072
3045
self . pending_monitor_events . push ( MonitorEvent :: HTLCEvent ( HTLCUpdate {
@@ -3089,7 +3062,6 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
3089
3062
commitment_tx_output_idx : input. previous_output . vout ,
3090
3063
preimage : Some ( payment_preimage) ,
3091
3064
on_to_local_output_csv : None ,
3092
- onchain_value_satoshis : Some ( onchain_amount_sat) ,
3093
3065
} ,
3094
3066
} ) ;
3095
3067
self . pending_monitor_events . push ( MonitorEvent :: HTLCEvent ( HTLCUpdate {
@@ -3117,7 +3089,6 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
3117
3089
source, payment_hash,
3118
3090
htlc_value_satoshis : Some ( amount_msat / 1000 ) ,
3119
3091
commitment_tx_output_idx : Some ( input. previous_output . vout ) ,
3120
- onchain_value_satoshis : Some ( onchain_amount_sat) ,
3121
3092
} ,
3122
3093
} ;
3123
3094
log_info ! ( logger, "Failing HTLC with payment_hash {} timeout by a spend tx, waiting for confirmation (at height {})" , log_bytes!( payment_hash. 0 ) , entry. confirmation_threshold( ) ) ;
0 commit comments