@@ -606,6 +606,10 @@ pub enum Balance {
606
606
/// The height at which the counterparty may be able to claim the balance if we have not
607
607
/// done so.
608
608
timeout_height : u32 ,
609
+ /// The payment hash that locks this HTLC.
610
+ payment_hash : PaymentHash ,
611
+ /// The preimage that can be used to claim this HTLC.
612
+ payment_preimage : PaymentPreimage ,
609
613
} ,
610
614
/// HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
611
615
/// fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
@@ -617,6 +621,8 @@ pub enum Balance {
617
621
/// The height at which we will be able to claim the balance if our counterparty has not
618
622
/// done so.
619
623
claimable_height : u32 ,
624
+ /// The payment hash whose preimage our counterparty needs to claim this HTLC.
625
+ payment_hash : PaymentHash ,
620
626
} ,
621
627
/// HTLCs which we received from our counterparty which are claimable with a preimage which we
622
628
/// do not currently have. This will only be claimable if we receive the preimage from the node
@@ -628,6 +634,8 @@ pub enum Balance {
628
634
/// The height at which our counterparty will be able to claim the balance if we have not
629
635
/// yet received the preimage and claimed it ourselves.
630
636
expiry_height : u32 ,
637
+ /// The payment hash whose preimage we need to claim this HTLC.
638
+ payment_hash : PaymentHash ,
631
639
} ,
632
640
/// The channel has been closed, and our counterparty broadcasted a revoked commitment
633
641
/// transaction.
@@ -1623,9 +1631,10 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
1623
1631
return Some ( Balance :: MaybeTimeoutClaimableHTLC {
1624
1632
claimable_amount_satoshis : htlc. amount_msat / 1000 ,
1625
1633
claimable_height : htlc. cltv_expiry ,
1634
+ payment_hash : htlc. payment_hash ,
1626
1635
} ) ;
1627
1636
}
1628
- } else if self . payment_preimages . get ( & htlc. payment_hash ) . is_some ( ) {
1637
+ } else if let Some ( payment_preimage ) = self . payment_preimages . get ( & htlc. payment_hash ) {
1629
1638
// Otherwise (the payment was inbound), only expose it as claimable if
1630
1639
// we know the preimage.
1631
1640
// Note that if there is a pending claim, but it did not use the
@@ -1641,12 +1650,15 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
1641
1650
return Some ( Balance :: ContentiousClaimable {
1642
1651
claimable_amount_satoshis : htlc. amount_msat / 1000 ,
1643
1652
timeout_height : htlc. cltv_expiry ,
1653
+ payment_hash : htlc. payment_hash ,
1654
+ payment_preimage : * payment_preimage,
1644
1655
} ) ;
1645
1656
}
1646
1657
} else if htlc_resolved. is_none ( ) {
1647
1658
return Some ( Balance :: MaybePreimageClaimableHTLC {
1648
1659
claimable_amount_satoshis : htlc. amount_msat / 1000 ,
1649
1660
expiry_height : htlc. cltv_expiry ,
1661
+ payment_hash : htlc. payment_hash ,
1650
1662
} ) ;
1651
1663
}
1652
1664
None
@@ -1808,6 +1820,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
1808
1820
res. push ( Balance :: MaybeTimeoutClaimableHTLC {
1809
1821
claimable_amount_satoshis : htlc. amount_msat / 1000 ,
1810
1822
claimable_height : htlc. cltv_expiry ,
1823
+ payment_hash : htlc. payment_hash ,
1811
1824
} ) ;
1812
1825
} else if us. payment_preimages . get ( & htlc. payment_hash ) . is_some ( ) {
1813
1826
claimable_inbound_htlc_value_sat += htlc. amount_msat / 1000 ;
@@ -1817,6 +1830,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
1817
1830
res. push ( Balance :: MaybePreimageClaimableHTLC {
1818
1831
claimable_amount_satoshis : htlc. amount_msat / 1000 ,
1819
1832
expiry_height : htlc. cltv_expiry ,
1833
+ payment_hash : htlc. payment_hash ,
1820
1834
} ) ;
1821
1835
}
1822
1836
}
0 commit comments