From 4ba7fdd48d7fe70dafb7a9ff3c24e38965a7a196 Mon Sep 17 00:00:00 2001 From: G8XSU <3442979+G8XSU@users.noreply.github.com> Date: Thu, 20 Mar 2025 12:41:46 -0700 Subject: [PATCH 1/2] Upgrade ldk-node to latest commit. --- Cargo.lock | 2 +- ldk-server/Cargo.toml | 2 +- ldk-server/src/main.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b8798a9..b69a582 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1055,7 +1055,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "ldk-node" version = "0.5.0+git" -source = "git+https://github.com/lightningdevkit/ldk-node.git?rev=6de350040e0fc5eb9cfcd15fad3919f5a79b82b9#6de350040e0fc5eb9cfcd15fad3919f5a79b82b9" +source = "git+https://github.com/lightningdevkit/ldk-node.git?rev=f0338d19256615088fabab2b6927d478ae3ec1a1#f0338d19256615088fabab2b6927d478ae3ec1a1" dependencies = [ "base64 0.22.1", "bdk_chain", diff --git a/ldk-server/Cargo.toml b/ldk-server/Cargo.toml index 25ad7f9..d5b7499 100644 --- a/ldk-server/Cargo.toml +++ b/ldk-server/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] -ldk-node = { git = "https://github.com/lightningdevkit/ldk-node.git", rev = "6de350040e0fc5eb9cfcd15fad3919f5a79b82b9" } +ldk-node = { git = "https://github.com/lightningdevkit/ldk-node.git", rev = "f0338d19256615088fabab2b6927d478ae3ec1a1" } serde = { version = "1.0.203", default-features = false, features = ["derive"] } serde_json = { version = "1.0.118", default-features = false } hyper = { version = "1", default-features = false, features = ["server", "http1"] } diff --git a/ldk-server/src/main.rs b/ldk-server/src/main.rs index abea935..9c2480f 100644 --- a/ldk-server/src/main.rs +++ b/ldk-server/src/main.rs @@ -65,7 +65,7 @@ fn main() { ldk_node_config.network = config_file.network; let mut builder = Builder::from_config(ldk_node_config); - builder.set_log_facade_logger(Some(LogLevel::Trace)); + builder.set_log_facade_logger(); let bitcoind_rpc_addr = config_file.bitcoind_rpc_addr; From 936ec303b36d4e5e0495eb799c802274d0f2fcfd Mon Sep 17 00:00:00 2001 From: G8XSU <3442979+G8XSU@users.noreply.github.com> Date: Thu, 20 Mar 2025 12:59:01 -0700 Subject: [PATCH 2/2] Add `fee_paid_msat` in Payment. --- ldk-server-protos/src/proto/types.proto | 6 ++++ ldk-server-protos/src/types.rs | 6 ++++ ldk-server/src/util/proto_adapter.rs | 43 +++++++++++++++++-------- 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/ldk-server-protos/src/proto/types.proto b/ldk-server-protos/src/proto/types.proto index fef6974..e8e23eb 100644 --- a/ldk-server-protos/src/proto/types.proto +++ b/ldk-server-protos/src/proto/types.proto @@ -13,6 +13,12 @@ message Payment { // The amount transferred. optional uint64 amount_msat = 3; + // The fees that were paid for this payment. + // + // For Lightning payments, this will only be updated for outbound payments once they + // succeeded. + optional uint64 fee_paid_msat = 7; + // The direction of the payment. PaymentDirection direction = 4; diff --git a/ldk-server-protos/src/types.rs b/ldk-server-protos/src/types.rs index 20f2c69..9c65fea 100644 --- a/ldk-server-protos/src/types.rs +++ b/ldk-server-protos/src/types.rs @@ -12,6 +12,12 @@ pub struct Payment { /// The amount transferred. #[prost(uint64, optional, tag = "3")] pub amount_msat: ::core::option::Option, + /// The fees that were paid for this payment. + /// + /// For Lightning payments, this will only be updated for outbound payments once they + /// succeeded. + #[prost(uint64, optional, tag = "7")] + pub fee_paid_msat: ::core::option::Option, /// The direction of the payment. #[prost(enumeration = "PaymentDirection", tag = "4")] pub direction: i32, diff --git a/ldk-server/src/util/proto_adapter.rs b/ldk-server/src/util/proto_adapter.rs index 6aa2c35..92dcada 100644 --- a/ldk-server/src/util/proto_adapter.rs +++ b/ldk-server/src/util/proto_adapter.rs @@ -96,22 +96,37 @@ pub(crate) fn channel_config_to_proto( } pub(crate) fn payment_to_proto(payment: PaymentDetails) -> Payment { - Payment { - id: payment.id.0.to_lower_hex_string(), - kind: Some(payment_kind_to_proto(payment.kind)), - amount_msat: payment.amount_msat, - direction: match payment.direction { - PaymentDirection::Inbound => ldk_server_protos::types::PaymentDirection::Inbound.into(), - PaymentDirection::Outbound => { - ldk_server_protos::types::PaymentDirection::Outbound.into() + match payment { + PaymentDetails { + id, + kind, + amount_msat, + fee_paid_msat, + direction, + status, + latest_update_timestamp, + } => Payment { + id: id.to_string(), + kind: Some(payment_kind_to_proto(kind)), + amount_msat, + fee_paid_msat, + direction: match direction { + PaymentDirection::Inbound => { + ldk_server_protos::types::PaymentDirection::Inbound.into() + }, + PaymentDirection::Outbound => { + ldk_server_protos::types::PaymentDirection::Outbound.into() + }, }, + status: match status { + PaymentStatus::Pending => ldk_server_protos::types::PaymentStatus::Pending.into(), + PaymentStatus::Succeeded => { + ldk_server_protos::types::PaymentStatus::Succeeded.into() + }, + PaymentStatus::Failed => ldk_server_protos::types::PaymentStatus::Failed.into(), + }, + latest_update_timestamp, }, - status: match payment.status { - PaymentStatus::Pending => ldk_server_protos::types::PaymentStatus::Pending.into(), - PaymentStatus::Succeeded => ldk_server_protos::types::PaymentStatus::Succeeded.into(), - PaymentStatus::Failed => ldk_server_protos::types::PaymentStatus::Failed.into(), - }, - latest_update_timestamp: payment.latest_update_timestamp, } }