Skip to content

Commit b96b19a

Browse files
authored
Merge pull request #3413 from TheBlueMatt/2024-11-async-persist-claiming-from-closed-chan-1
Misc updates to tee up async `ChannelMonitorUpdate` persist for claims against closed channels
2 parents 8a54da6 + b50354d commit b96b19a

File tree

6 files changed

+341
-130
lines changed

6 files changed

+341
-130
lines changed

lightning/src/chain/channelmonitor.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -3147,8 +3147,11 @@ impl<Signer: EcdsaChannelSigner> ChannelMonitorImpl<Signer> {
31473147
panic!("Attempted to apply post-force-close ChannelMonitorUpdate that wasn't providing a payment preimage");
31483148
},
31493149
}
3150-
} else if self.latest_update_id + 1 != updates.update_id {
3151-
panic!("Attempted to apply ChannelMonitorUpdates out of order, check the update_id before passing an update to update_monitor!");
3150+
}
3151+
if updates.update_id != LEGACY_CLOSED_CHANNEL_UPDATE_ID {
3152+
if self.latest_update_id + 1 != updates.update_id {
3153+
panic!("Attempted to apply ChannelMonitorUpdates out of order, check the update_id before passing an update to update_monitor!");
3154+
}
31523155
}
31533156
let mut ret = Ok(());
31543157
let bounded_fee_estimator = LowerBoundedFeeEstimator::new(&**fee_estimator);

lightning/src/ln/chanmon_update_fail_tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3288,7 +3288,7 @@ fn do_test_durable_preimages_on_closed_channel(close_chans_before_reload: bool,
32883288
// Finally, check that B created a payment preimage transaction and close out the payment.
32893289
let bs_txn = nodes[1].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0);
32903290
assert_eq!(bs_txn.len(), if close_chans_before_reload && !close_only_a { 2 } else { 1 });
3291-
let bs_preimage_tx = &bs_txn[0];
3291+
let bs_preimage_tx = bs_txn.iter().find(|tx| tx.input[0].previous_output.txid == as_closing_tx[0].compute_txid()).unwrap();
32923292
check_spends!(bs_preimage_tx, as_closing_tx[0]);
32933293

32943294
if !close_chans_before_reload {

0 commit comments

Comments
 (0)