Skip to content

Commit 6c017cc

Browse files
Stop hardcoding from_onchain in monitor ev claim_funds
In upcoming commits, we'll be generating monitor events for off-chain claims as well as on-chain. As a small prefactor, calculate the from_onchain value rather than hardcoding it to true.
1 parent 30b5068 commit 6c017cc

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

lightning/src/ln/channelmanager.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13584,14 +13584,26 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
1358413584
"Claiming HTLC with preimage {} from our monitor",
1358513585
preimage
1358613586
);
13587+
let from_onchain = self
13588+
.per_peer_state
13589+
.read()
13590+
.unwrap()
13591+
.get(&counterparty_node_id)
13592+
.map_or(true, |peer_state_mtx| {
13593+
!peer_state_mtx
13594+
.lock()
13595+
.unwrap()
13596+
.channel_by_id
13597+
.contains_key(&channel_id)
13598+
});
1358713599
// Claim the funds from the previous hop, if there is one. Because this is in response to a
1358813600
// chain event, no attribution data is available.
1358913601
self.claim_funds_internal(
1359013602
htlc_update.source,
1359113603
preimage,
1359213604
htlc_update.htlc_value_satoshis.map(|v| v * 1000),
1359313605
None,
13594-
true,
13606+
from_onchain,
1359513607
counterparty_node_id,
1359613608
funding_outpoint,
1359713609
channel_id,

0 commit comments

Comments
 (0)