Skip to content

Commit 36bda24

Browse files
committed
fixup! Add support for sending to human-readable names that resolve to Bolt12 Offers
1 parent 6db5faa commit 36bda24

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
@@ -107,7 +107,7 @@ impl Bolt12Payment {
107107
hash: None,
108108
preimage: None,
109109
secret: None,
110-
offer_id: offer.id(),
110+
offer_id: Some(offer.id()),
111111
payer_note: payer_note.map(UntrustedString),
112112
quantity,
113113
};
@@ -132,7 +132,7 @@ impl Bolt12Payment {
132132
hash: None,
133133
preimage: None,
134134
secret: None,
135-
offer_id: offer.id(),
135+
offer_id: Some(offer.id()),
136136
payer_note: payer_note.map(UntrustedString),
137137
quantity,
138138
};
@@ -213,7 +213,7 @@ impl Bolt12Payment {
213213
hash: None,
214214
preimage: None,
215215
secret: None,
216-
offer_id: offer.id(),
216+
offer_id: Some(offer.id()),
217217
payer_note: payer_note.map(UntrustedString),
218218
quantity,
219219
};
@@ -238,7 +238,7 @@ impl Bolt12Payment {
238238
hash: None,
239239
preimage: None,
240240
secret: None,
241-
offer_id: offer.id(),
241+
offer_id: Some(offer.id()),
242242
payer_note: payer_note.map(UntrustedString),
243243
quantity,
244244
};
@@ -295,7 +295,14 @@ impl Bolt12Payment {
295295
) {
296296
Ok(()) => {
297297
log_info!(self.logger, "Initiated sending {} msats to {}", amount_msat, name);
298-
let kind = PaymentKind::HrnBolt12Offer { hrn };
298+
let kind = PaymentKind::Bolt12Offer {
299+
hash: None,
300+
preimage: None,
301+
secret: None,
302+
offer_id: None,
303+
payer_note: None,
304+
quantity: None
305+
};
299306
let payment = PaymentDetails::new(
300307
payment_id,
301308
kind,
@@ -309,7 +316,14 @@ impl Bolt12Payment {
309316
},
310317
Err(()) => {
311318
log_error!(self.logger, "Failed to send payment to {}", name);
312-
let kind = PaymentKind::HrnBolt12Offer { hrn };
319+
let kind = PaymentKind::Bolt12Offer {
320+
hash: None,
321+
preimage: None,
322+
secret: None,
323+
offer_id: None,
324+
payer_note: None,
325+
quantity: None
326+
};
313327
let payment = PaymentDetails::new(
314328
payment_id,
315329
kind,

src/payment/store.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ pub enum PaymentKind {
395395
/// The secret used by the payment.
396396
secret: Option<PaymentSecret>,
397397
/// The ID of the offer this payment is for.
398-
offer_id: OfferId,
398+
offer_id: Option<OfferId>,
399399
/// The payer note for the payment.
400400
///
401401
/// Truncated to [`PAYER_NOTE_LIMIT`] characters.

0 commit comments

Comments
 (0)