Skip to content

Commit 4f0abe9

Browse files
committed
Persist FundedChannel::pending_splice
Once a splice funding transaction has been constructed, the corresponding state must be persisted so that the process can be continued across restarts. This includes exchanging signatures, waiting for enough confirmations, and RBF'ing.
1 parent 5fecde5 commit 4f0abe9

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

lightning/src/ln/channel.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2563,6 +2563,13 @@ struct PendingFunding {
25632563
received_funding_txid: Option<Txid>,
25642564
}
25652565

2566+
impl_writeable_tlv_based!(PendingFunding, {
2567+
(1, funding_negotiation, upgradable_option),
2568+
(3, negotiated_candidates, required_vec),
2569+
(5, sent_funding_txid, option),
2570+
(7, received_funding_txid, option),
2571+
});
2572+
25662573
enum FundingNegotiation {
25672574
AwaitingAck {
25682575
context: FundingNegotiationContext,
@@ -2576,6 +2583,13 @@ enum FundingNegotiation {
25762583
},
25772584
}
25782585

2586+
impl_writeable_tlv_based_enum_upgradable!(FundingNegotiation,
2587+
(0, AwaitingSignatures) => {
2588+
(1, funding, required),
2589+
},
2590+
unread_variants: AwaitingAck, ConstructingTransaction
2591+
);
2592+
25792593
impl FundingNegotiation {
25802594
fn as_funding(&self) -> Option<&FundingScope> {
25812595
match self {
@@ -14294,6 +14308,7 @@ where
1429414308
(60, self.context.historical_scids, optional_vec), // Added in 0.2
1429514309
(61, fulfill_attribution_data, optional_vec), // Added in 0.2
1429614310
(63, holder_commitment_point_current, option), // Added in 0.2
14311+
(64, self.pending_splice, option), // Added in 0.2
1429714312
(65, self.quiescent_action, option), // Added in 0.2
1429814313
});
1429914314

@@ -14655,6 +14670,7 @@ where
1465514670

1465614671
let mut minimum_depth_override: Option<u32> = None;
1465714672

14673+
let mut pending_splice: Option<PendingFunding> = None;
1465814674
let mut quiescent_action = None;
1465914675

1466014676
read_tlv_fields!(reader, {
@@ -14699,6 +14715,7 @@ where
1469914715
(60, historical_scids, optional_vec), // Added in 0.2
1470014716
(61, fulfill_attribution_data, optional_vec), // Added in 0.2
1470114717
(63, holder_commitment_point_current_opt, option), // Added in 0.2
14718+
(64, pending_splice, option), // Added in 0.2
1470214719
(65, quiescent_action, upgradable_option), // Added in 0.2
1470314720
});
1470414721

@@ -15059,7 +15076,7 @@ where
1505915076
},
1506015077
interactive_tx_signing_session,
1506115078
holder_commitment_point,
15062-
pending_splice: None,
15079+
pending_splice,
1506315080
quiescent_action,
1506415081
})
1506515082
}

0 commit comments

Comments
 (0)