Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trampoline Payload Construction Method #3386

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lightning/src/ln/blinded_payment_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,8 @@ fn route_blinding_spec_test_vector() {
hops: blinded_hops,
blinding_point: bob_blinding_point,
excess_final_cltv_expiry_delta: 0,
final_value_msat: amt_msat
final_value_msat: amt_msat,
final_hop_supports_trampoline: false
}),
};
let cur_height = 747_000;
Expand Down
8 changes: 8 additions & 0 deletions lightning/src/routing/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,13 +404,16 @@ pub struct BlindedTail {
pub excess_final_cltv_expiry_delta: u32,
/// The total amount paid on this [`Path`], excluding the fees.
pub final_value_msat: u64,
/// Used for determining the type of Trampoline path to construct
pub final_hop_supports_trampoline: bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we instead consider storing a *Features of some form?

}

impl_writeable_tlv_based!(BlindedTail, {
(0, hops, required_vec),
(2, blinding_point, required),
(4, excess_final_cltv_expiry_delta, required),
(6, final_value_msat, required),
(8, final_hop_supports_trampoline, required),
});

/// A path in a [`Route`] to the payment recipient. Must always be at least length one.
Expand Down Expand Up @@ -3343,6 +3346,7 @@ where L::Target: Logger {
blinding_point: blinded_path.blinding_point(),
excess_final_cltv_expiry_delta: 0,
final_value_msat: h.fee_msat,
final_hop_supports_trampoline: false
})
} else { None }
});
Expand Down Expand Up @@ -7692,6 +7696,7 @@ mod tests {
blinding_point: ln_test_utils::pubkey(43),
excess_final_cltv_expiry_delta: 40,
final_value_msat: 100,
final_hop_supports_trampoline: false,
})}, Path {
hops: vec![RouteHop {
pubkey: ln_test_utils::pubkey(51),
Expand All @@ -7718,6 +7723,7 @@ mod tests {
blinding_point: ln_test_utils::pubkey(47),
excess_final_cltv_expiry_delta: 41,
final_value_msat: 101,
final_hop_supports_trampoline: false,
});
let encoded_route = route.encode();
let decoded_route: Route = Readable::read(&mut Cursor::new(&encoded_route[..])).unwrap();
Expand Down Expand Up @@ -7754,6 +7760,7 @@ mod tests {
blinding_point: ln_test_utils::pubkey(48),
excess_final_cltv_expiry_delta: 0,
final_value_msat: 200,
final_hop_supports_trampoline: false,
}),
};
inflight_htlcs.process_path(&path, ln_test_utils::pubkey(44));
Expand Down Expand Up @@ -7792,6 +7799,7 @@ mod tests {
blinding_point: ln_test_utils::pubkey(44),
excess_final_cltv_expiry_delta: 0,
final_value_msat: 200,
final_hop_supports_trampoline: false,
}),
}], route_params: None};

Expand Down
1 change: 1 addition & 0 deletions lightning/src/routing/scoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3402,6 +3402,7 @@ mod tests {
blinding_point: test_utils::pubkey(42),
excess_final_cltv_expiry_delta: recipient_hop.cltv_expiry_delta,
final_value_msat: recipient_hop.fee_msat,
final_hop_supports_trampoline: false
});

// Check the liquidity before and after scoring payment failures to ensure the blinded path's
Expand Down