Skip to content

Commit eb35f20

Browse files
committed
f: cfg-gate TrampolineForward
1 parent 56d4647 commit eb35f20

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ pub enum PendingHTLCRouting {
171171
incoming_cltv_expiry: Option<u32>,
172172
},
173173
/// An HTLC which should be forwarded on to another Trampoline node.
174+
#[cfg(trampoline)]
174175
TrampolineForward {
175176
/// The onion shared secret we build with the sender (or the preceding Trampoline node) used
176177
/// to decrypt the onion.
@@ -288,6 +289,7 @@ impl PendingHTLCRouting {
288289
fn blinded_failure(&self) -> Option<BlindedFailure> {
289290
match self {
290291
Self::Forward { blinded: Some(BlindedForward { failure, .. }), .. } => Some(*failure),
292+
#[cfg(trampoline)]
291293
Self::TrampolineForward { blinded: Some(BlindedForward { failure, .. }), .. } => Some(*failure),
292294
Self::Receive { requires_blinded_error: true, .. } => Some(BlindedFailure::FromBlindedNode),
293295
Self::ReceiveKeysend { requires_blinded_error: true, .. } => Some(BlindedFailure::FromBlindedNode),
@@ -298,6 +300,7 @@ impl PendingHTLCRouting {
298300
fn incoming_cltv_expiry(&self) -> Option<u32> {
299301
match self {
300302
Self::Forward { incoming_cltv_expiry, .. } => *incoming_cltv_expiry,
303+
#[cfg(trampoline)]
301304
Self::TrampolineForward { incoming_cltv_expiry, .. } => Some(*incoming_cltv_expiry),
302305
Self::Receive { incoming_cltv_expiry, .. } => Some(*incoming_cltv_expiry),
303306
Self::ReceiveKeysend { incoming_cltv_expiry, .. } => Some(*incoming_cltv_expiry),
@@ -8929,6 +8932,7 @@ This indicates a bug inside LDK. Please report this error at https://github.com/
89298932
for (forward_info, prev_htlc_id) in pending_forwards.drain(..) {
89308933
let scid = match forward_info.routing {
89318934
PendingHTLCRouting::Forward { short_channel_id, .. } => short_channel_id,
8935+
#[cfg(trampoline)]
89328936
PendingHTLCRouting::TrampolineForward { .. } => 0,
89338937
PendingHTLCRouting::Receive { .. } => 0,
89348938
PendingHTLCRouting::ReceiveKeysend { .. } => 0,
@@ -12470,6 +12474,36 @@ impl_writeable_tlv_based!(BlindedForward, {
1247012474
(3, next_blinding_override, option),
1247112475
});
1247212476

12477+
#[cfg(not(trampoline))]
12478+
impl_writeable_tlv_based_enum!(PendingHTLCRouting,
12479+
(0, Forward) => {
12480+
(0, onion_packet, required),
12481+
(1, blinded, option),
12482+
(2, short_channel_id, required),
12483+
(3, incoming_cltv_expiry, option),
12484+
},
12485+
(1, Receive) => {
12486+
(0, payment_data, required),
12487+
(1, phantom_shared_secret, option),
12488+
(2, incoming_cltv_expiry, required),
12489+
(3, payment_metadata, option),
12490+
(5, custom_tlvs, optional_vec),
12491+
(7, requires_blinded_error, (default_value, false)),
12492+
(9, payment_context, option),
12493+
},
12494+
(2, ReceiveKeysend) => {
12495+
(0, payment_preimage, required),
12496+
(1, requires_blinded_error, (default_value, false)),
12497+
(2, incoming_cltv_expiry, required),
12498+
(3, payment_metadata, option),
12499+
(4, payment_data, option), // Added in 0.0.116
12500+
(5, custom_tlvs, optional_vec),
12501+
(7, has_recipient_created_payment_secret, (default_value, false)),
12502+
(9, payment_context, option),
12503+
(11, invoice_request, option),
12504+
},
12505+
);
12506+
#[cfg(trampoline)]
1247312507
impl_writeable_tlv_based_enum!(PendingHTLCRouting,
1247412508
(0, Forward) => {
1247512509
(0, onion_packet, required),

0 commit comments

Comments
 (0)