Skip to content

Commit 35e9dd7

Browse files
committed
Consistently use PaymentId as hex-string.
1 parent 7cedb55 commit 35e9dd7

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

ldk-server-protos/src/api.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ pub struct Bolt11SendRequest {
147147
#[allow(clippy::derive_partial_eq_without_eq)]
148148
#[derive(Clone, PartialEq, ::prost::Message)]
149149
pub struct Bolt11SendResponse {
150-
/// An identifier used to uniquely identify a payment.
151-
#[prost(bytes = "bytes", tag = "1")]
152-
pub payment_id: ::prost::bytes::Bytes,
150+
/// An identifier used to uniquely identify a payment in hex-encoded form.
151+
#[prost(string, tag = "1")]
152+
pub payment_id: ::prost::alloc::string::String,
153153
}
154154
/// Returns a BOLT12 offer for the given amount, if specified.
155155
///
@@ -211,9 +211,9 @@ pub struct Bolt12SendRequest {
211211
#[allow(clippy::derive_partial_eq_without_eq)]
212212
#[derive(Clone, PartialEq, ::prost::Message)]
213213
pub struct Bolt12SendResponse {
214-
/// An identifier used to uniquely identify a payment.
215-
#[prost(bytes = "bytes", tag = "1")]
216-
pub payment_id: ::prost::bytes::Bytes,
214+
/// An identifier used to uniquely identify a payment in hex-encoded form.
215+
#[prost(string, tag = "1")]
216+
pub payment_id: ::prost::alloc::string::String,
217217
}
218218
/// Creates a new outbound channel to the given remote node.
219219
/// See more: <https://docs.rs/ldk-node/latest/ldk_node/struct.Node.html#method.connect_open_channel>

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ message Bolt11SendRequest {
145145
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
146146
message Bolt11SendResponse {
147147

148-
// An identifier used to uniquely identify a payment.
149-
bytes payment_id = 1;
148+
// An identifier used to uniquely identify a payment in hex-encoded form.
149+
string payment_id = 1;
150150
}
151151

152152
// Returns a BOLT12 offer for the given amount, if specified.
@@ -205,8 +205,8 @@ message Bolt12SendRequest {
205205
// When HttpStatusCode is not OK (non-200), the response `content` contains a serialized `ErrorResponse`.
206206
message Bolt12SendResponse {
207207

208-
// An identifier used to uniquely identify a payment.
209-
bytes payment_id = 1;
208+
// An identifier used to uniquely identify a payment in hex-encoded form.
209+
string payment_id = 1;
210210
}
211211

212212
// Creates a new outbound channel to the given remote node.

ldk-server/src/api/bolt11_send.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::api::error::LdkServerError;
22
use crate::service::Context;
3-
use bytes::Bytes;
43
use ldk_node::lightning_invoice::Bolt11Invoice;
54
use ldk_server_protos::api::{Bolt11SendRequest, Bolt11SendResponse};
65
use std::str::FromStr;
@@ -20,6 +19,6 @@ pub(crate) fn handle_bolt11_send_request(
2019
},
2120
}?;
2221

23-
let response = Bolt11SendResponse { payment_id: Bytes::from(payment_id.0.to_vec()) };
22+
let response = Bolt11SendResponse { payment_id: payment_id.to_string() };
2423
Ok(response)
2524
}

ldk-server/src/api/bolt12_send.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::api::error::LdkServerError;
22
use crate::service::Context;
3-
use bytes::Bytes;
43
use ldk_node::lightning::offers::offer::Offer;
54
use ldk_server_protos::api::{Bolt12SendRequest, Bolt12SendResponse};
65
use std::str::FromStr;
@@ -23,6 +22,6 @@ pub(crate) fn handle_bolt12_send_request(
2322
),
2423
}?;
2524

26-
let response = Bolt12SendResponse { payment_id: Bytes::from(payment_id.0.to_vec()) };
25+
let response = Bolt12SendResponse { payment_id: payment_id.to_string() };
2726
Ok(response)
2827
}

0 commit comments

Comments
 (0)