Skip to content

Commit 99247a9

Browse files
authored
Merge pull request #4257 from wpaulino/funding-transaction-signed-rework
Rework ChannelManager::funding_transaction_signed
2 parents b9c1a72 + e502ce3 commit 99247a9

File tree

5 files changed

+492
-494
lines changed

5 files changed

+492
-494
lines changed

lightning/src/events/mod.rs

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,7 @@ pub enum Event {
18361836
///
18371837
/// # Failure Behavior and Persistence
18381838
/// This event will eventually be replayed after failures-to-handle (i.e., the event handler
1839-
/// returning `Err(ReplayEvent ())`), but will only be regenerated as needed after restarts.
1839+
/// returning `Err(ReplayEvent ())`) and will be persisted across restarts.
18401840
///
18411841
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
18421842
/// [`ChannelManager::funding_transaction_signed`]: crate::ln::channelmanager::ChannelManager::funding_transaction_signed
@@ -2305,10 +2305,19 @@ impl Writeable for Event {
23052305
47u8.write(writer)?;
23062306
// Never write StaticInvoiceRequested events as buffered onion messages aren't serialized.
23072307
},
2308-
&Event::FundingTransactionReadyForSigning { .. } => {
2309-
49u8.write(writer)?;
2310-
// We never write out FundingTransactionReadyForSigning events as they will be regenerated when
2311-
// necessary.
2308+
&Event::FundingTransactionReadyForSigning {
2309+
ref channel_id,
2310+
ref counterparty_node_id,
2311+
ref user_channel_id,
2312+
ref unsigned_transaction,
2313+
} => {
2314+
48u8.write(writer)?;
2315+
write_tlv_fields!(writer, {
2316+
(1, channel_id, required),
2317+
(3, counterparty_node_id, required),
2318+
(5, user_channel_id, required),
2319+
(7, unsigned_transaction, required),
2320+
});
23122321
},
23132322
&Event::SplicePending {
23142323
ref channel_id,
@@ -2931,8 +2940,24 @@ impl MaybeReadable for Event {
29312940
45u8 => Ok(None),
29322941
// Note that we do not write a length-prefixed TLV for StaticInvoiceRequested events.
29332942
47u8 => Ok(None),
2934-
// Note that we do not write a length-prefixed TLV for FundingTransactionReadyForSigning events.
2935-
49u8 => Ok(None),
2943+
48u8 => {
2944+
let mut f = || {
2945+
_init_and_read_len_prefixed_tlv_fields!(reader, {
2946+
(1, channel_id, required),
2947+
(3, counterparty_node_id, required),
2948+
(5, user_channel_id, required),
2949+
(7, unsigned_transaction, required),
2950+
});
2951+
2952+
Ok(Some(Event::FundingTransactionReadyForSigning {
2953+
channel_id: channel_id.0.unwrap(),
2954+
user_channel_id: user_channel_id.0.unwrap(),
2955+
counterparty_node_id: counterparty_node_id.0.unwrap(),
2956+
unsigned_transaction: unsigned_transaction.0.unwrap(),
2957+
}))
2958+
};
2959+
f()
2960+
},
29362961
50u8 => {
29372962
let mut f = || {
29382963
_init_and_read_len_prefixed_tlv_fields!(reader, {

0 commit comments

Comments
 (0)