Skip to content

Commit 9f89be1

Browse files
committed
Add custom tlvs to PendingOutboundPayment::Retryable
1 parent 64713a6 commit 9f89be1

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8736,6 +8736,7 @@ where
87368736
payment_secret: None, // only used for retries, and we'll never retry on startup
87378737
payment_metadata: None, // only used for retries, and we'll never retry on startup
87388738
keysend_preimage: None, // only used for retries, and we'll never retry on startup
8739+
custom_tlvs: Vec::new(), // only used for retries, and we'll never retry on startup
87398740
pending_amt_msat: path_amt,
87408741
pending_fee_msat: Some(path_fee),
87418742
total_msat: path_amt,

lightning/src/ln/outbound_payment.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ pub(crate) enum PendingOutboundPayment {
4747
payment_secret: Option<PaymentSecret>,
4848
payment_metadata: Option<Vec<u8>>,
4949
keysend_preimage: Option<PaymentPreimage>,
50+
custom_tlvs: Vec<(u64, Vec<u8>)>,
5051
pending_amt_msat: u64,
5152
/// Used to track the fee paid. Only present if the payment was serialized on 0.0.103+.
5253
pending_fee_msat: Option<u64>,
@@ -799,7 +800,8 @@ impl OutboundPayments {
799800
hash_map::Entry::Occupied(mut payment) => {
800801
let res = match payment.get() {
801802
PendingOutboundPayment::Retryable {
802-
total_msat, keysend_preimage, payment_secret, payment_metadata, pending_amt_msat, ..
803+
total_msat, keysend_preimage, payment_secret, payment_metadata,
804+
custom_tlvs, pending_amt_msat, ..
803805
} => {
804806
let retry_amt_msat = route.get_total_amount();
805807
if retry_amt_msat + *pending_amt_msat > *total_msat * (100 + RETRY_OVERFLOW_PERCENTAGE) / 100 {
@@ -810,7 +812,7 @@ impl OutboundPayments {
810812
(*total_msat, RecipientOnionFields {
811813
payment_secret: *payment_secret,
812814
payment_metadata: payment_metadata.clone(),
813-
custom_tlvs: Vec::new(),
815+
custom_tlvs: custom_tlvs.clone(),
814816
}, *keysend_preimage)
815817
},
816818
PendingOutboundPayment::Legacy { .. } => {
@@ -1011,6 +1013,7 @@ impl OutboundPayments {
10111013
payment_secret: recipient_onion.payment_secret,
10121014
payment_metadata: recipient_onion.payment_metadata,
10131015
keysend_preimage,
1016+
custom_tlvs: recipient_onion.custom_tlvs,
10141017
starting_block_height: best_block_height,
10151018
total_msat: route.get_total_amount(),
10161019
});
@@ -1460,6 +1463,7 @@ impl_writeable_tlv_based_enum_upgradable!(PendingOutboundPayment,
14601463
(6, total_msat, required),
14611464
(7, payment_metadata, option),
14621465
(8, pending_amt_msat, required),
1466+
(9, custom_tlvs, optional_vec),
14631467
(10, starting_block_height, required),
14641468
(not_written, retry_strategy, (static_value, None)),
14651469
(not_written, attempts, (static_value, PaymentAttempts::new())),

0 commit comments

Comments
 (0)