diff --git a/Cargo.lock b/Cargo.lock index 64618fc5..6178dcb3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -458,7 +458,7 @@ checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf" [[package]] name = "bitcoin-payment-instructions" version = "0.6.0" -source = "git+https://github.com/tnull/bitcoin-payment-instructions?rev=ea50a9d2a8da524b69a2af43233706666cf2ffa5#ea50a9d2a8da524b69a2af43233706666cf2ffa5" +source = "git+https://github.com/jkczyz/bitcoin-payment-instructions?rev=869fd348c3ca0c78f439d2f31181f4d798c6b20e#869fd348c3ca0c78f439d2f31181f4d798c6b20e" dependencies = [ "bitcoin", "dnssec-prover", @@ -624,12 +624,6 @@ dependencies = [ "windows-link", ] -[[package]] -name = "chunked_transfer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901" - [[package]] name = "cipher" version = "0.4.4" @@ -1711,7 +1705,6 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "ldk-node" version = "0.8.0+git" -source = "git+https://github.com/lightningdevkit/ldk-node?rev=9e0cfc5fa9b9dd74fefb795580d00b0a46c8f3a3#9e0cfc5fa9b9dd74fefb795580d00b0a46c8f3a3" dependencies = [ "base64 0.22.1", "bdk_chain", @@ -1726,6 +1719,7 @@ dependencies = [ "chrono", "electrum-client", "esplora-client", + "getrandom 0.3.4", "libc", "lightning", "lightning-background-processor", @@ -1740,7 +1734,6 @@ dependencies = [ "lightning-types", "log", "prost", - "rand 0.9.2", "rusqlite", "rustls 0.23.34", "serde", @@ -1838,7 +1831,7 @@ dependencies = [ [[package]] name = "lightning" version = "0.3.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bech32", "bitcoin", @@ -1855,7 +1848,7 @@ dependencies = [ [[package]] name = "lightning-background-processor" version = "0.3.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bitcoin", "bitcoin-io", @@ -1869,10 +1862,10 @@ dependencies = [ [[package]] name = "lightning-block-sync" version = "0.3.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bitcoin", - "chunked_transfer", + "bitreq", "lightning", "serde_json", "tokio", @@ -1881,7 +1874,7 @@ dependencies = [ [[package]] name = "lightning-invoice" version = "0.35.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bech32", "bitcoin", @@ -1892,7 +1885,7 @@ dependencies = [ [[package]] name = "lightning-liquidity" version = "0.3.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bitcoin", "chrono", @@ -1907,7 +1900,7 @@ dependencies = [ [[package]] name = "lightning-macros" version = "0.2.2+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "proc-macro2", "quote", @@ -1917,7 +1910,7 @@ dependencies = [ [[package]] name = "lightning-net-tokio" version = "0.3.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bitcoin", "lightning", @@ -1927,7 +1920,7 @@ dependencies = [ [[package]] name = "lightning-persister" version = "0.3.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bitcoin", "lightning", @@ -1938,7 +1931,7 @@ dependencies = [ [[package]] name = "lightning-rapid-gossip-sync" version = "0.3.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bitcoin", "bitcoin-io", @@ -1949,7 +1942,7 @@ dependencies = [ [[package]] name = "lightning-transaction-sync" version = "0.3.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bitcoin", "electrum-client", @@ -1962,7 +1955,7 @@ dependencies = [ [[package]] name = "lightning-types" version = "0.4.0+git" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "bitcoin", ] @@ -2327,7 +2320,7 @@ dependencies = [ [[package]] name = "possiblyrandom" version = "0.2.0" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0#b6c17c593a5d7bacb18fe3b9f69074a0596ae8f0" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=98501d6e5134228c41460dcf786ab53337e41245#98501d6e5134228c41460dcf786ab53337e41245" dependencies = [ "getrandom 0.2.16", ] diff --git a/ldk-server-protos/src/api.rs b/ldk-server-protos/src/api.rs index b8d23a75..fd22d7b1 100644 --- a/ldk-server-protos/src/api.rs +++ b/ldk-server-protos/src/api.rs @@ -80,6 +80,14 @@ pub struct GetNodeInfoResponse { /// Will be empty if no announcement addresses are configured. #[prost(string, repeated, tag = "12")] pub node_uris: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// The init, node announcement, channel, and invoice features. + /// + /// Should be always set, will never be `None`. + #[prost(message, optional, tag = "13")] + pub features: ::core::option::Option, + /// The bitcoin network the node is running on. + #[prost(string, tag = "14")] + pub network: ::prost::alloc::string::String, } /// Retrieve a new on-chain funding address. /// See more: diff --git a/ldk-server-protos/src/proto/api.proto b/ldk-server-protos/src/proto/api.proto index 57c7b2fe..eb65123f 100644 --- a/ldk-server-protos/src/proto/api.proto +++ b/ldk-server-protos/src/proto/api.proto @@ -70,6 +70,14 @@ message GetNodeInfoResponse { // These are constructed from the announcement addresses and the node's public key. // Will be empty if no announcement addresses are configured. repeated string node_uris = 12; + + // The init, node announcement, channel, and invoice features. + // + // Should be always set, will never be `None`. + types.Features features = 13; + + // The bitcoin network the node is running on. + string network = 14; } // Retrieve a new on-chain funding address. diff --git a/ldk-server-protos/src/proto/types.proto b/ldk-server-protos/src/proto/types.proto index 73061692..a20bb2a5 100644 --- a/ldk-server-protos/src/proto/types.proto +++ b/ldk-server-protos/src/proto/types.proto @@ -704,3 +704,18 @@ message RouteParametersConfig { // Default value: 2 uint32 max_channel_saturation_power_of_half = 4; } + +// Represents the node's init, node announcement, channel, and invoice features. +message Features { + // Serialized init features. + bytes init = 1; + + // Serialized node features. + bytes node = 2; + + // Serialized channel features. + bytes channel = 3; + + // Serialized invoice features. + bytes invoice = 4; +} \ No newline at end of file diff --git a/ldk-server-protos/src/types.rs b/ldk-server-protos/src/types.rs index 07098166..dc73221f 100644 --- a/ldk-server-protos/src/types.rs +++ b/ldk-server-protos/src/types.rs @@ -909,6 +909,25 @@ pub struct RouteParametersConfig { #[prost(uint32, tag = "4")] pub max_channel_saturation_power_of_half: u32, } +/// Represents the node's init, node announcement, channel, and invoice features. +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct Features { + /// Serialized init features. + #[prost(bytes = "bytes", tag = "1")] + pub init: ::prost::bytes::Bytes, + /// Serialized node features. + #[prost(bytes = "bytes", tag = "2")] + pub node: ::prost::bytes::Bytes, + /// Serialized channel features. + #[prost(bytes = "bytes", tag = "3")] + pub channel: ::prost::bytes::Bytes, + /// Serialized invoice features. + #[prost(bytes = "bytes", tag = "4")] + pub invoice: ::prost::bytes::Bytes, +} /// Represents the direction of a payment. #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))] diff --git a/ldk-server/Cargo.toml b/ldk-server/Cargo.toml index dc87fc32..2cdd1e2a 100644 --- a/ldk-server/Cargo.toml +++ b/ldk-server/Cargo.toml @@ -4,7 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -ldk-node = { git = "https://github.com/lightningdevkit/ldk-node", rev = "9e0cfc5fa9b9dd74fefb795580d00b0a46c8f3a3" } +# ldk-node = { git = "https://github.com/lightningdevkit/ldk-node", rev = "9e0cfc5fa9b9dd74fefb795580d00b0a46c8f3a3" } +ldk-node = { git = "https://github.com/lightningdevkit/ldk-node", rev = "refs/pull/810/head" } serde = { version = "1.0.203", default-features = false, features = ["derive"] } hyper = { version = "1", default-features = false, features = ["server", "http1"] } http-body-util = { version = "0.1", default-features = false } diff --git a/ldk-server/src/api/get_node_info.rs b/ldk-server/src/api/get_node_info.rs index c1b81279..caa3c385 100644 --- a/ldk-server/src/api/get_node_info.rs +++ b/ldk-server/src/api/get_node_info.rs @@ -7,8 +7,9 @@ // You may not use this file except in accordance with one or both of these // licenses. +use ldk_node::lightning::util::ser::Writeable; use ldk_server_protos::api::{GetNodeInfoRequest, GetNodeInfoResponse}; -use ldk_server_protos::types::BestBlock; +use ldk_server_protos::types::{BestBlock, Features}; use crate::api::error::LdkServerError; use crate::service::Context; @@ -23,6 +24,19 @@ pub(crate) fn handle_get_node_info_request( height: node_status.current_best_block.height, }; + let network = context.node.config().network.to_string(); + + let node_features = context.node.node_features(); + let init_features = context.node.init_features(); + let channel_features = context.node.channel_features(); + let invoice_features = context.node.bolt11_invoice_features(); + let features = Features { + init: init_features.encode().into(), + node: node_features.encode().into(), + channel: channel_features.encode().into(), + invoice: invoice_features.encode().into(), + }; + let listening_addresses: Vec = context .node .listening_addresses() @@ -60,6 +74,8 @@ pub(crate) fn handle_get_node_info_request( announcement_addresses, node_alias, node_uris, + features: Some(features), + network, }; Ok(response) }