Skip to content

Commit f978f9b

Browse files
f read+ignore deprecated pending inbounds
1 parent 74aae2e commit f978f9b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,6 +1238,7 @@ pub(super) const FEERATE_TRACKING_BLOCKS: usize = 144;
12381238
///
12391239
/// Note that this struct will be removed entirely soon, in favor of storing no inbound payment data
12401240
/// and instead encoding it in the payment secret.
1241+
#[derive(Debug)]
12411242
struct PendingInboundPayment {
12421243
/// The payment secret that the sender must use for us to accept this payment
12431244
payment_secret: PaymentSecret,
@@ -12416,9 +12417,14 @@ where
1241612417
let _last_node_announcement_serial: u32 = Readable::read(reader)?; // Only used < 0.0.111
1241712418
let highest_seen_timestamp: u32 = Readable::read(reader)?;
1241812419

12419-
// The last version where a pending inbound payment may have been written was 0.0.116.
12420+
// The last version where a pending inbound payment may have been added was 0.0.116.
1242012421
let pending_inbound_payment_count: u64 = Readable::read(reader)?;
12421-
if pending_inbound_payment_count != 0 { return Err(DecodeError::InvalidValue) }
12422+
for _ in 0..pending_inbound_payment_count {
12423+
let payment_hash: PaymentHash = Readable::read(reader)?;
12424+
let logger = WithContext::from(&args.logger, None, None, Some(payment_hash));
12425+
let inbound: PendingInboundPayment = Readable::read(reader)?;
12426+
log_warn!(logger, "Ignoring deprecated pending inbound payment with payment hash {}: {:?}", payment_hash, inbound);
12427+
}
1242212428

1242312429
let pending_outbound_payments_count_compat: u64 = Readable::read(reader)?;
1242412430
let mut pending_outbound_payments_compat: HashMap<PaymentId, PendingOutboundPayment> =
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Backwards Compatibility
2+
* Pending inbound payments added in versions 0.0.116 or earlier using the
3+
`create_inbound_payment{,_for_hash}_legacy` API will be ignored on `ChannelManager`
4+
deserialization and fail to be received
5+
6+

0 commit comments

Comments
 (0)