Skip to content

Commit 40f11e6

Browse files
committed
Stop reading unused PaymentDetails JIT TLV field
1 parent ac6b669 commit 40f11e6

1 file changed

Lines changed: 0 additions & 55 deletions

File tree

src/payment/store.rs

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ impl Writeable for PaymentDetails {
6868
) -> Result<(), lightning::io::Error> {
6969
write_tlv_fields!(writer, {
7070
(0, self.id, required), // Used to be `hash` for v0.2.1 and prior
71-
// 1 briefly used to be lsp_fee_limits, could probably be reused at some point in the future.
7271
// 2 used to be `preimage` before it was moved to `kind` in v0.3.0
7372
(2, None::<Option<PaymentPreimage>>, required),
7473
(3, self.kind, required),
@@ -92,7 +91,6 @@ impl Readable for PaymentDetails {
9291
.as_secs();
9392
_init_and_read_len_prefixed_tlv_fields!(reader, {
9493
(0, id, required), // Used to be `hash`
95-
(1, lsp_fee_limits, option),
9694
(2, preimage, required),
9795
(3, kind_opt, option),
9896
(4, secret, required),
@@ -129,7 +127,6 @@ impl Readable for PaymentDetails {
129127
let hash = PaymentHash(id.0);
130128

131129
if secret.is_some() {
132-
let _: Option<LSPS2Parameters> = lsp_fee_limits;
133130
PaymentKind::Bolt11 { hash, preimage, secret, counterparty_skimmed_fee_msat: None }
134131
} else {
135132
PaymentKind::Spontaneous { hash, preimage }
@@ -605,12 +602,10 @@ mod tests {
605602
pub amount_msat: Option<u64>,
606603
pub direction: PaymentDirection,
607604
pub status: PaymentStatus,
608-
pub lsp_fee_limits: Option<LSPS2Parameters>,
609605
}
610606

611607
impl_writeable_tlv_based!(OldPaymentDetails, {
612608
(0, hash, required),
613-
(1, lsp_fee_limits, option),
614609
(2, preimage, required),
615610
(4, secret, required),
616611
(6, amount_msat, required),
@@ -636,7 +631,6 @@ mod tests {
636631
amount_msat,
637632
direction: PaymentDirection::Inbound,
638633
status: PaymentStatus::Pending,
639-
lsp_fee_limits: None,
640634
};
641635

642636
let old_bolt11_encoded = old_bolt11_payment.encode();
@@ -667,54 +661,6 @@ mod tests {
667661
}
668662
}
669663

670-
// Test `Bolt11Jit` de/ser
671-
{
672-
let lsp_fee_limits = Some(LSPS2Parameters {
673-
max_total_opening_fee_msat: Some(46_000),
674-
max_proportional_opening_fee_ppm_msat: Some(47_000),
675-
});
676-
677-
let old_bolt11_jit_payment = OldPaymentDetails {
678-
hash,
679-
preimage,
680-
secret,
681-
amount_msat,
682-
direction: PaymentDirection::Inbound,
683-
status: PaymentStatus::Pending,
684-
lsp_fee_limits,
685-
};
686-
687-
let old_bolt11_jit_encoded = old_bolt11_jit_payment.encode();
688-
assert_eq!(
689-
old_bolt11_jit_payment,
690-
OldPaymentDetails::read(&mut &*old_bolt11_jit_encoded.clone()).unwrap()
691-
);
692-
693-
let bolt11_jit_decoded = PaymentDetails::read(&mut &*old_bolt11_jit_encoded).unwrap();
694-
let bolt11_jit_reencoded = bolt11_jit_decoded.encode();
695-
assert_eq!(
696-
bolt11_jit_decoded,
697-
PaymentDetails::read(&mut &*bolt11_jit_reencoded).unwrap()
698-
);
699-
700-
match bolt11_jit_decoded.kind {
701-
PaymentKind::Bolt11 {
702-
hash: h,
703-
preimage: p,
704-
secret: s,
705-
counterparty_skimmed_fee_msat: c,
706-
} => {
707-
assert_eq!(hash, h);
708-
assert_eq!(preimage, p);
709-
assert_eq!(secret, s);
710-
assert_eq!(None, c);
711-
},
712-
_ => {
713-
panic!("Unexpected kind!");
714-
},
715-
}
716-
}
717-
718664
// Test `Spontaneous` de/ser
719665
{
720666
let old_spontaneous_payment = OldPaymentDetails {
@@ -724,7 +670,6 @@ mod tests {
724670
amount_msat,
725671
direction: PaymentDirection::Inbound,
726672
status: PaymentStatus::Pending,
727-
lsp_fee_limits: None,
728673
};
729674

730675
let old_spontaneous_encoded = old_spontaneous_payment.encode();

0 commit comments

Comments
 (0)