Skip to content

Commit cb5d264

Browse files
benthecarmanclaude
andcommitted
Replace REST with gRPC on server
Switch from HTTP/1.1 protobuf-over-REST to gRPC over HTTP/2, implemented directly on hyper without tonic. The gRPC framing module handles encode/decode of the 5-byte length-prefixed wire format, status codes, and HTTP/2 trailers. Key changes: - hyper http1 → http2, add TokioExecutor for HTTP/2 connections - TLS ALPN set to h2 for HTTP/2 negotiation - HMAC auth simplified to timestamp-only (no body) since TLS guarantees integrity - Events delivered via tokio broadcast channel, replacing the RabbitMQ EventPublisher infrastructure - Config renamed rest_service_addr → grpc_service_addr - Removed lapin, async-trait, events-rabbitmq feature Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 113a77d commit cb5d264

11 files changed

Lines changed: 338 additions & 1028 deletions

File tree

ldk-server/Cargo.toml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ edition = "2021"
66
[dependencies]
77
ldk-node = { git = "https://github.com/lightningdevkit/ldk-node", rev = "3aef2b39265ae60b29f4d60de8291895f12eb880" }
88
serde = { version = "1.0.203", default-features = false, features = ["derive"] }
9-
hyper = { version = "1", default-features = false, features = ["server", "http1"] }
9+
hyper = { version = "1", default-features = false, features = ["server", "http2"] }
1010
http-body-util = { version = "0.1", default-features = false }
11-
hyper-util = { version = "0.1", default-features = false, features = ["server-graceful"] }
12-
tokio = { version = "1.38.0", default-features = false, features = ["time", "signal", "rt-multi-thread"] }
11+
hyper-util = { version = "0.1", default-features = false, features = ["server-graceful", "tokio"] }
12+
tokio = { version = "1.38.0", default-features = false, features = ["time", "signal", "rt-multi-thread", "sync"] }
1313
tokio-rustls = { version = "0.26", default-features = false, features = ["ring"] }
1414
ring = { version = "0.17", default-features = false }
1515
getrandom = { version = "0.2", default-features = false }
@@ -18,25 +18,17 @@ ldk-server-grpc = { path = "../ldk-server-grpc" }
1818
bytes = { version = "1.4.0", default-features = false }
1919
hex = { package = "hex-conservative", version = "0.2.1", default-features = false }
2020
rusqlite = { version = "0.31.0", features = ["bundled"] }
21-
async-trait = { version = "0.1.85", default-features = false }
2221
toml = { version = "0.8.9", default-features = false, features = ["parse"] }
2322
chrono = { version = "0.4", default-features = false, features = ["clock"] }
2423
log = "0.4.28"
2524
base64 = { version = "0.21", default-features = false, features = ["std"] }
2625
clap = { version = "4.0.5", default-features = false, features = ["derive", "std", "error-context", "suggestions", "help", "env"] }
2726

28-
# Required for RabittMQ based EventPublisher. Only enabled for `events-rabbitmq` feature.
29-
lapin = { version = "2.4.0", features = ["rustls"], default-features = false, optional = true }
30-
3127
[features]
3228
default = []
33-
events-rabbitmq = ["dep:lapin"]
3429

3530
# Experimental Features.
3631
experimental-lsps2-support = []
3732

38-
# Feature-flags related to integration tests.
39-
integration-tests-events-rabbitmq = ["events-rabbitmq"]
40-
4133
[dev-dependencies]
4234
futures-util = "0.3.31"

ldk-server/ldk-server-config.toml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
network = "regtest" # Bitcoin network to use
44
listening_addresses = ["localhost:3001"] # Lightning node listening addresses
55
announcement_addresses = ["54.3.7.81:3001"] # Lightning node announcement addresses
6-
#rest_service_address = "127.0.0.1:3536" # LDK Server REST address (optional, defaults to 127.0.0.1:3536)
6+
#grpc_service_address = "127.0.0.1:3536" # LDK Server gRPC address (optional, defaults to 127.0.0.1:3536)
77
alias = "ldk_server" # Lightning node alias
88
#pathfinding_scores_source_url = "" # External Pathfinding Scores Source
99
#rgs_server_url = "https://rapidsync.lightningdevkit.org/snapshot/v2/" # Optional: RGS URL for rapid gossip sync
@@ -38,11 +38,6 @@ server_url = "ssl://electrum.blockstream.info:50002" # Electrum endpoint
3838
[esplora]
3939
server_url = "https://mempool.space/api" # Esplora endpoint
4040

41-
# RabbitMQ settings (only required if using events-rabbitmq feature)
42-
[rabbitmq]
43-
connection_string = "" # RabbitMQ connection string
44-
exchange_name = ""
45-
4641
# LSPS2 Client Support
4742
[liquidity.lsps2_client]
4843
# The public key of the LSPS2 LSP we source just-in-time liquidity from.

ldk-server/src/io/events/event_publisher.rs

Lines changed: 0 additions & 68 deletions
This file was deleted.

ldk-server/src/io/events/mod.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)