Skip to content

Commit 855ce29

Browse files
committed
Update create_refund_builder to exclusively use create_blinded_paths
Reasoning: The reasoning remains the same as for the `create_offer_builder` case, ensuring consistency in the default behavior and maintaining flexibility for custom implementations.
1 parent 20b6de6 commit 855ce29

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

lightning/src/ln/offers_tests.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,9 @@ fn creates_short_lived_refund() {
455455

456456
let absolute_expiry = bob.offers_handler.duration_since_epoch() + MAX_SHORT_LIVED_RELATIVE_EXPIRY;
457457
let payment_id = PaymentId([1; 32]);
458+
let router = DefaultMessageRouter::compact_blinded_paths(bob.network_graph, bob.node.entropy_source);
458459
let refund = bob.offers_handler
459-
.create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None)
460+
.create_refund_builder_using_router(router, 10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None)
460461
.unwrap()
461462
.build().unwrap();
462463
assert_eq!(refund.absolute_expiry(), Some(absolute_expiry));

lightning/src/offers/flow.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,17 +1331,19 @@ macro_rules! create_refund_builder { ($self: ident, $builder: ty) => {
13311331
let secp_ctx = &$self.secp_ctx;
13321332

13331333
let nonce = Nonce::from_entropy_source(entropy);
1334-
let context = OffersContext::OutboundPayment { payment_id, nonce, hmac: None };
1335-
let path = $self.create_blinded_paths_using_absolute_expiry(context, Some(absolute_expiry))
1336-
.and_then(|paths| paths.into_iter().next().ok_or(()))
1334+
let context = MessageContext::Offers(OffersContext::OutboundPayment { payment_id, nonce, hmac: None });
1335+
let paths = $self.create_blinded_paths(context)
13371336
.map_err(|_| Bolt12SemanticError::MissingPaths)?;
13381337

1339-
let builder = RefundBuilder::deriving_signing_pubkey(
1338+
let mut builder = RefundBuilder::deriving_signing_pubkey(
13401339
node_id, expanded_key, nonce, secp_ctx, amount_msats, payment_id
13411340
)?
13421341
.chain_hash($self.commons.get_chain_hash())
1343-
.absolute_expiry(absolute_expiry)
1344-
.path(path);
1342+
.absolute_expiry(absolute_expiry);
1343+
1344+
for path in paths {
1345+
builder = builder.path(path);
1346+
}
13451347

13461348
let expiration = StaleExpiration::AbsoluteTimeout(absolute_expiry);
13471349

0 commit comments

Comments
 (0)