@@ -586,13 +586,20 @@ pub enum Balance {
586
586
#[ derive( PartialEq ) ]
587
587
struct IrrevocablyResolvedHTLC {
588
588
commitment_tx_output_idx : u32 ,
589
+ /// The txid of the transaction which resolved the HTLC, this may be a commitment,
590
+ /// HTLC-Success, or HTLC-Timeout transaction.
591
+ resolving_txid : Option < Txid > ,
592
+ /// The amount of the output for this HTLC in `resolving_txid`.
593
+ onchain_value_satoshis : Option < u64 > ,
589
594
/// Only set if the HTLC claim was ours using a payment preimage
590
595
payment_preimage : Option < PaymentPreimage > ,
591
596
}
592
597
593
598
impl_writeable_tlv_based ! ( IrrevocablyResolvedHTLC , {
594
599
( 0 , commitment_tx_output_idx, required) ,
600
+ ( 1 , resolving_txid, option) ,
595
601
( 2 , payment_preimage, option) ,
602
+ ( 3 , onchain_value_satoshis, option) ,
596
603
} ) ;
597
604
598
605
/// A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
@@ -2695,7 +2702,10 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2695
2702
htlc_value_satoshis,
2696
2703
} ) ) ;
2697
2704
if let Some ( idx) = commitment_tx_output_idx {
2698
- self . htlcs_resolved_on_chain . push ( IrrevocablyResolvedHTLC { commitment_tx_output_idx : idx, payment_preimage : None } ) ;
2705
+ self . htlcs_resolved_on_chain . push ( IrrevocablyResolvedHTLC {
2706
+ commitment_tx_output_idx : idx, resolving_txid : Some ( entry. txid ) ,
2707
+ payment_preimage : None , onchain_value_satoshis,
2708
+ } ) ;
2699
2709
}
2700
2710
} ,
2701
2711
OnchainEvent :: MaturingOutput { descriptor } => {
@@ -2704,8 +2714,10 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2704
2714
outputs : vec ! [ descriptor]
2705
2715
} ) ;
2706
2716
} ,
2707
- OnchainEvent :: HTLCSpendConfirmation { commitment_tx_output_idx, preimage, .. } => {
2708
- self . htlcs_resolved_on_chain . push ( IrrevocablyResolvedHTLC { commitment_tx_output_idx, payment_preimage : preimage } ) ;
2717
+ OnchainEvent :: HTLCSpendConfirmation { commitment_tx_output_idx, preimage, onchain_value_satoshis, .. } => {
2718
+ self . htlcs_resolved_on_chain . push ( IrrevocablyResolvedHTLC {
2719
+ commitment_tx_output_idx, resolving_txid : Some ( entry. txid ) ,
2720
+ payment_preimage : preimage, onchain_value_satoshis } ) ;
2709
2721
} ,
2710
2722
OnchainEvent :: FundingSpendConfirmation { commitment_tx_to_counterparty_output, .. } => {
2711
2723
self . funding_spend_confirmed = Some ( entry. txid ) ;
0 commit comments