Skip to content

Commit ee23649

Browse files
committed
Preserve funding_transaction for the later lifecycle of the channel, simple solution
1 parent e0838be commit ee23649

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

lightning/src/ln/channel.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5486,7 +5486,8 @@ impl<SP: Deref> Channel<SP> where
54865486
(matches!(self.context.channel_state, ChannelState::AwaitingChannelReady(flags) if !flags.is_set(AwaitingChannelReadyFlags::WAITING_FOR_BATCH)) ||
54875487
matches!(self.context.channel_state, ChannelState::ChannelReady(_)))
54885488
{
5489-
self.context.funding_transaction.take()
5489+
// Take the funding transaction, do not clear the field
5490+
self.context.funding_transaction.clone()
54905491
} else { None };
54915492
// That said, if the funding transaction is already confirmed (ie we're active with a
54925493
// minimum_depth over 0) don't bother re-broadcasting the confirmed funding tx.
@@ -7893,6 +7894,7 @@ impl<SP: Deref> OutboundV1Channel<SP> where SP::Target: SignerProvider {
78937894
self.context.minimum_depth = Some(COINBASE_MATURITY);
78947895
}
78957896

7897+
debug_assert!(self.context.funding_transaction.is_none());
78967898
self.context.funding_transaction = Some(funding_transaction);
78977899
self.context.is_batch_funding = Some(()).filter(|_| is_batch_funding);
78987900

lightning/src/ln/payment_tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ fn do_test_completed_payment_not_retryable_on_reload(use_dust: bool) {
891891
nodes[0].node.timer_tick_occurred();
892892
assert!(nodes[0].node.list_channels().is_empty());
893893
assert!(nodes[0].node.has_pending_payments());
894-
assert_eq!(nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0).len(), 1);
894+
assert_eq!(nodes[0].tx_broadcaster.txn_broadcasted.lock().unwrap().split_off(0).len(), 4);
895895
check_added_monitors!(nodes[0], 1);
896896

897897
nodes[0].node.peer_connected(nodes[1].node.get_our_node_id(), &msgs::Init {

0 commit comments

Comments
 (0)