@@ -1891,6 +1891,21 @@ impl ChannelMonitor {
1891
1891
}
1892
1892
}
1893
1893
1894
+ macro_rules! check_htlc_valid_remote {
1895
+ ( $remote_txid: expr, $htlc_output: expr) => {
1896
+ if let & Some ( txid) = $remote_txid {
1897
+ for & ( ref pending_htlc, ref pending_source) in self . remote_claimable_outpoints. get( & txid) . unwrap( ) {
1898
+ if pending_htlc. payment_hash == $htlc_output. payment_hash && pending_htlc. amount_msat == $htlc_output. amount_msat {
1899
+ if let & Some ( ref source) = pending_source {
1900
+ payment_data = Some ( ( ( * * source) . clone( ) , $htlc_output. payment_hash) ) ;
1901
+ break ;
1902
+ }
1903
+ }
1904
+ }
1905
+ }
1906
+ }
1907
+ }
1908
+
1894
1909
macro_rules! scan_commitment {
1895
1910
( $htlcs: expr, $tx_info: expr, $local_tx: expr) => {
1896
1911
for ( ref htlc_output, source_option) in $htlcs {
@@ -1903,6 +1918,10 @@ impl ChannelMonitor {
1903
1918
// has timed out, or we screwed up. In any case, we should now
1904
1919
// resolve the source HTLC with the original sender.
1905
1920
payment_data = Some ( ( ( * source) . clone( ) , htlc_output. payment_hash) ) ;
1921
+ } else if let Storage :: Local { ref current_remote_commitment_txid, .. } = self . key_storage {
1922
+ check_htlc_valid_remote!( current_remote_commitment_txid, htlc_output) ;
1923
+ } else if let Storage :: Local { ref prev_remote_commitment_txid, .. } = self . key_storage {
1924
+ check_htlc_valid_remote!( prev_remote_commitment_txid, htlc_output) ;
1906
1925
} else {
1907
1926
log_claim!( $tx_info, $local_tx, htlc_output, false ) ;
1908
1927
continue ' outer_loop;
0 commit comments