Skip to content

Commit 266aebe

Browse files
committed
Update create_refund_builder to use create_blinded_paths
Aligned the `create_refund_builder` logic with `create_offer_builder` by updating it to use `create_blinded_paths`. Now that custom routers can be passed via `create_refund_builder_using_router`, the default builder can consistently generate full-length blinded paths without branching logic. This simplifies the default behavior while keeping flexibility available for custom use cases.
1 parent 56d03d9 commit 266aebe

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10322,8 +10322,8 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
1032210322
let secp_ctx = &$self.secp_ctx;
1032310323

1032410324
let nonce = Nonce::from_entropy_source(entropy);
10325-
let context = OffersContext::OutboundPayment { payment_id, nonce, hmac: None };
10326-
let path = $self.create_blinded_paths_using_absolute_expiry(context, Some(absolute_expiry))
10325+
let context = MessageContext::Offers(OffersContext::OutboundPayment { payment_id, nonce, hmac: None });
10326+
let path = $self.create_blinded_paths(context)
1032710327
.and_then(|paths| paths.into_iter().next().ok_or(()))
1032810328
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
1032910329

lightning/src/ln/offers_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,11 @@ fn creates_short_lived_refund() {
454454
let bob = &nodes[1];
455455
let bob_id = bob.node.get_our_node_id();
456456

457+
let router = CompactMessageRouter::new(alice.network_graph, alice.node.entropy_source);
457458
let absolute_expiry = bob.node.duration_since_epoch() + MAX_SHORT_LIVED_RELATIVE_EXPIRY;
458459
let payment_id = PaymentId([1; 32]);
459460
let refund = bob.node
460-
.create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), RouteParametersConfig::default())
461+
.create_refund_builder_using_router(router, 10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), RouteParametersConfig::default())
461462
.unwrap()
462463
.build().unwrap();
463464
assert_eq!(refund.absolute_expiry(), Some(absolute_expiry));

0 commit comments

Comments
 (0)