Skip to content

Commit f6f00f1

Browse files
committed
fixup! Add support for sending to human-readable names that resolve to Bolt12 Offers
1 parent 0e0613e commit f6f00f1

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/payment/bolt12.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl Bolt12Payment {
118118
hash: None,
119119
preimage: None,
120120
secret: None,
121-
offer_id: offer.id(),
121+
offer_id: Some(offer.id()),
122122
payer_note: payer_note.map(UntrustedString),
123123
quantity,
124124
};
@@ -143,7 +143,7 @@ impl Bolt12Payment {
143143
hash: None,
144144
preimage: None,
145145
secret: None,
146-
offer_id: offer.id(),
146+
offer_id: Some(offer.id()),
147147
payer_note: payer_note.map(UntrustedString),
148148
quantity,
149149
};
@@ -225,7 +225,7 @@ impl Bolt12Payment {
225225
hash: None,
226226
preimage: None,
227227
secret: None,
228-
offer_id: offer.id(),
228+
offer_id: Some(offer.id()),
229229
payer_note: payer_note.map(UntrustedString),
230230
quantity,
231231
};
@@ -250,7 +250,7 @@ impl Bolt12Payment {
250250
hash: None,
251251
preimage: None,
252252
secret: None,
253-
offer_id: offer.id(),
253+
offer_id: Some(offer.id()),
254254
payer_note: payer_note.map(UntrustedString),
255255
quantity,
256256
};
@@ -307,7 +307,14 @@ impl Bolt12Payment {
307307
) {
308308
Ok(()) => {
309309
log_info!(self.logger, "Initiated sending {} msats to {}", amount_msat, name);
310-
let kind = PaymentKind::HrnBolt12Offer { hrn };
310+
let kind = PaymentKind::Bolt12Offer {
311+
hash: None,
312+
preimage: None,
313+
secret: None,
314+
offer_id: None,
315+
payer_note: None,
316+
quantity: None
317+
};
311318
let payment = PaymentDetails::new(
312319
payment_id,
313320
kind,
@@ -321,7 +328,14 @@ impl Bolt12Payment {
321328
},
322329
Err(()) => {
323330
log_error!(self.logger, "Failed to send payment to {}", name);
324-
let kind = PaymentKind::HrnBolt12Offer { hrn };
331+
let kind = PaymentKind::Bolt12Offer {
332+
hash: None,
333+
preimage: None,
334+
secret: None,
335+
offer_id: None,
336+
payer_note: None,
337+
quantity: None
338+
};
325339
let payment = PaymentDetails::new(
326340
payment_id,
327341
kind,

src/payment/store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ pub enum PaymentKind {
404404
/// The secret used by the payment.
405405
secret: Option<PaymentSecret>,
406406
/// The ID of the offer this payment is for.
407-
offer_id: OfferId,
407+
offer_id: Option<OfferId>,
408408
/// The payer note for the payment.
409409
///
410410
/// Truncated to [`PAYER_NOTE_LIMIT`] characters.

0 commit comments

Comments
 (0)