Skip to content

Commit 78f428e

Browse files
committed
Proper serialization of new field in TLVs (b/w comp)
1 parent ef5830a commit 78f428e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

lightning/src/ln/channel.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8893,7 +8893,6 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
88938893

88948894
self.context.channel_transaction_parameters.write(writer)?;
88958895
self.context.funding_transaction.write(writer)?;
8896-
self.context.funding_transaction_broadcast.write(writer)?;
88978896

88988897
self.context.counterparty_cur_commitment_point.write(writer)?;
88998898
self.context.counterparty_prev_commitment_point.write(writer)?;
@@ -8954,6 +8953,8 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
89548953
let cur_holder_commitment_point = Some(self.context.holder_commitment_point.current_point());
89558954
let next_holder_commitment_point = self.context.holder_commitment_point.next_point();
89568955

8956+
let funding_transaction_broadcast = Some(self.context.funding_transaction_broadcast);
8957+
89578958
write_tlv_fields!(writer, {
89588959
(0, self.context.announcement_sigs, option),
89598960
// minimum_depth and counterparty_selected_channel_reserve_satoshis used to have a
@@ -8994,7 +8995,8 @@ impl<SP: Deref> Writeable for Channel<SP> where SP::Target: SignerProvider {
89948995
(47, next_holder_commitment_point, option),
89958996
(49, self.context.local_initiated_shutdown, option), // Added in 0.0.122
89968997
(51, is_manual_broadcast, option), // Added in 0.0.124
8997-
(53, funding_tx_broadcast_safe_event_emitted, option) // Added in 0.0.124
8998+
(53, funding_tx_broadcast_safe_event_emitted, option), // Added in 0.0.124
8999+
(55, funding_transaction_broadcast, option), // Added in 1.0.1
89989000
});
89999001

90009002
Ok(())
@@ -9234,7 +9236,6 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
92349236

92359237
let mut channel_parameters: ChannelTransactionParameters = Readable::read(reader)?;
92369238
let funding_transaction: Option<Transaction> = Readable::read(reader)?;
9237-
let funding_transaction_broadcast: bool = Readable::read(reader)?;
92389239

92399240
let counterparty_cur_commitment_point = Readable::read(reader)?;
92409241

@@ -9310,6 +9311,8 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
93109311
let mut next_holder_commitment_point_opt: Option<PublicKey> = None;
93119312
let mut is_manual_broadcast = None;
93129313

9314+
let mut funding_transaction_broadcast: Option<bool> = None;
9315+
93139316
read_tlv_fields!(reader, {
93149317
(0, announcement_sigs, option),
93159318
(1, minimum_depth, option),
@@ -9345,6 +9348,7 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
93459348
(49, local_initiated_shutdown, option),
93469349
(51, is_manual_broadcast, option),
93479350
(53, funding_tx_broadcast_safe_event_emitted, option),
9351+
(55, funding_transaction_broadcast, option), // Added in 1.0.1
93489352
});
93499353

93509354
let (channel_keys_id, holder_signer) = if let Some(channel_keys_id) = channel_keys_id {
@@ -9563,7 +9567,8 @@ impl<'a, 'b, 'c, ES: Deref, SP: Deref> ReadableArgs<(&'a ES, &'b SP, u32, &'c Ch
95639567

95649568
channel_transaction_parameters: channel_parameters,
95659569
funding_transaction,
9566-
funding_transaction_broadcast,
9570+
// If value is missing, we use false, which may result in rebroadcast
9571+
funding_transaction_broadcast: funding_transaction_broadcast.unwrap_or(false),
95679572
is_batch_funding,
95689573

95699574
counterparty_cur_commitment_point,

0 commit comments

Comments
 (0)