Skip to content

Commit 20725f3

Browse files
committed
Fetch latest commitment txn via monitor, not channel in test
This removes the last uses of channel.monitor_update() for latest local commitment transactions (though it is still used for would_broadcast_at_height())
1 parent cd4af59 commit 20725f3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lightning/src/ln/functional_test_utils.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,17 @@ macro_rules! get_feerate {
259259

260260
macro_rules! get_local_commitment_txn {
261261
($node: expr, $channel_id: expr) => {
262-
$node.node.channel_state.lock().unwrap().by_id.get_mut(&$channel_id).unwrap().channel_monitor().get_latest_local_commitment_txn()
262+
{
263+
let mut monitors = $node.chan_monitor.simple_monitor.monitors.lock().unwrap();
264+
let mut commitment_txn = None;
265+
for (funding_txo, monitor) in monitors.iter_mut() {
266+
if funding_txo.to_channel_id() == $channel_id {
267+
commitment_txn = Some(monitor.get_latest_local_commitment_txn());
268+
break;
269+
}
270+
}
271+
commitment_txn.unwrap()
272+
}
263273
}
264274
}
265275

0 commit comments

Comments
 (0)