Skip to content

Commit 9899a54

Browse files
committed
fixup! Add support for sending to human-readable names that resolve to Bolt12 Offers
1 parent 7e8348a commit 9899a54

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
@@ -105,7 +105,7 @@ impl Bolt12Payment {
105105
hash: None,
106106
preimage: None,
107107
secret: None,
108-
offer_id: offer.id(),
108+
offer_id: Some(offer.id()),
109109
payer_note: payer_note.map(UntrustedString),
110110
quantity,
111111
};
@@ -130,7 +130,7 @@ impl Bolt12Payment {
130130
hash: None,
131131
preimage: None,
132132
secret: None,
133-
offer_id: offer.id(),
133+
offer_id: Some(offer.id()),
134134
payer_note: payer_note.map(UntrustedString),
135135
quantity,
136136
};
@@ -211,7 +211,7 @@ impl Bolt12Payment {
211211
hash: None,
212212
preimage: None,
213213
secret: None,
214-
offer_id: offer.id(),
214+
offer_id: Some(offer.id()),
215215
payer_note: payer_note.map(UntrustedString),
216216
quantity,
217217
};
@@ -236,7 +236,7 @@ impl Bolt12Payment {
236236
hash: None,
237237
preimage: None,
238238
secret: None,
239-
offer_id: offer.id(),
239+
offer_id: Some(offer.id()),
240240
payer_note: payer_note.map(UntrustedString),
241241
quantity,
242242
};
@@ -293,7 +293,14 @@ impl Bolt12Payment {
293293
) {
294294
Ok(()) => {
295295
log_info!(self.logger, "Initiated sending {} msats to {}", amount_msat, name);
296-
let kind = PaymentKind::HrnBolt12Offer { hrn };
296+
let kind = PaymentKind::Bolt12Offer {
297+
hash: None,
298+
preimage: None,
299+
secret: None,
300+
offer_id: None,
301+
payer_note: None,
302+
quantity: None
303+
};
297304
let payment = PaymentDetails::new(
298305
payment_id,
299306
kind,
@@ -307,7 +314,14 @@ impl Bolt12Payment {
307314
},
308315
Err(()) => {
309316
log_error!(self.logger, "Failed to send payment to {}", name);
310-
let kind = PaymentKind::HrnBolt12Offer { hrn };
317+
let kind = PaymentKind::Bolt12Offer {
318+
hash: None,
319+
preimage: None,
320+
secret: None,
321+
offer_id: None,
322+
payer_note: None,
323+
quantity: None
324+
};
311325
let payment = PaymentDetails::new(
312326
payment_id,
313327
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)