Skip to content

Commit c1ee8cf

Browse files
committed
Return offer id in Bolt12ReceiveResponse
Same motivation as the bolt11 change, allow us to track bolt 12 receives without having to decode the offer.
1 parent 822f151 commit c1ee8cf

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

ldk-server-protos/src/api.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ pub struct Bolt12ReceiveResponse {
395395
/// to the recipient.
396396
#[prost(string, tag = "1")]
397397
pub offer: ::prost::alloc::string::String,
398+
/// The hex-encoded offer id.
399+
#[prost(string, tag = "2")]
400+
pub offer_id: ::prost::alloc::string::String,
398401
}
399402
/// Send a payment for a BOLT12 offer.
400403
/// See more:

ldk-server-protos/src/proto/api.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,9 @@ message Bolt12ReceiveResponse {
328328
// With the details of the offer, the sender has all the data necessary to send a payment
329329
// to the recipient.
330330
string offer = 1;
331+
332+
// The hex-encoded offer id.
333+
string offer_id = 2;
331334
}
332335

333336
// Send a payment for a BOLT12 offer.

ldk-server/src/api/bolt12_receive.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10+
use hex::DisplayHex;
1011
use ldk_server_protos::api::{Bolt12ReceiveRequest, Bolt12ReceiveResponse};
1112

1213
use crate::api::error::LdkServerError;
@@ -28,6 +29,7 @@ pub(crate) fn handle_bolt12_receive_request(
2829
.receive_variable_amount(&request.description, request.expiry_secs)?,
2930
};
3031

31-
let response = Bolt12ReceiveResponse { offer: offer.to_string() };
32+
let offer_id = offer.id().0.to_lower_hex_string();
33+
let response = Bolt12ReceiveResponse { offer: offer.to_string(), offer_id };
3234
Ok(response)
3335
}

0 commit comments

Comments
 (0)