Skip to content

Commit 68ecf8c

Browse files
benthecarmanclaude
andcommitted
Add Rapid Gossip Sync support
Allow configuring an RGS server URL. When set, the node uses RGS instead of P2P gossip. This can be faster than syncing the entire network graph and can reduce bandwidth usage. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3485059 commit 68ecf8c

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

ldk-server/ldk-server-config.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ announcement_addresses = ["54.3.7.81:3001"] # Lightning node announcement addr
66
rest_service_address = "127.0.0.1:3002" # LDK Server REST address
77
alias = "ldk_server" # Lightning node alias
88
#pathfinding_scores_source_url = "" # External Pathfinding Scores Source
9+
#rgs_server_url = "https://rapidsync.lightningdevkit.org/snapshot/v2/" # Optional: RGS URL for rapid gossip sync
910

1011
# Storage settings
1112
[storage.disk]

ldk-server/src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ fn main() {
167167
builder.set_pathfinding_scores_source(pathfinding_scores_source);
168168
}
169169

170+
if let Some(rgs_server_url) = config_file.rgs_server_url {
171+
builder.set_gossip_source_rgs(rgs_server_url);
172+
}
173+
170174
// LSPS2 support is highly experimental and for testing purposes only.
171175
#[cfg(feature = "experimental-lsps2-support")]
172176
builder.set_liquidity_provider_lsps2(

ldk-server/src/util/config.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub struct Config {
4646
pub rest_service_addr: SocketAddr,
4747
pub storage_dir_path: Option<String>,
4848
pub chain_source: ChainSource,
49+
pub rgs_server_url: Option<String>,
4950
pub rabbitmq_connection_string: String,
5051
pub rabbitmq_exchange_name: String,
5152
pub lsps2_service_config: Option<LSPS2ServiceConfig>,
@@ -83,6 +84,7 @@ struct ConfigBuilder {
8384
bitcoind_rpc_address: Option<String>,
8485
bitcoind_rpc_user: Option<String>,
8586
bitcoind_rpc_password: Option<String>,
87+
rgs_server_url: Option<String>,
8688
rabbitmq_connection_string: Option<String>,
8789
rabbitmq_exchange_name: Option<String>,
8890
lsps2: Option<LiquidityConfig>,
@@ -104,6 +106,7 @@ impl ConfigBuilder {
104106
self.alias = node.alias.or(self.alias.clone());
105107
self.pathfinding_scores_source_url =
106108
node.pathfinding_scores_source_url.or(self.pathfinding_scores_source_url.clone());
109+
self.rgs_server_url = node.rgs_server_url.or(self.rgs_server_url.clone());
107110
}
108111

109112
if let Some(storage) = toml.storage {
@@ -349,6 +352,7 @@ impl ConfigBuilder {
349352
rest_service_addr,
350353
storage_dir_path: self.storage_dir_path,
351354
chain_source,
355+
rgs_server_url: self.rgs_server_url,
352356
rabbitmq_connection_string,
353357
rabbitmq_exchange_name,
354358
lsps2_service_config,
@@ -381,6 +385,7 @@ struct NodeConfig {
381385
rest_service_address: Option<String>,
382386
alias: Option<String>,
383387
pathfinding_scores_source_url: Option<String>,
388+
rgs_server_url: Option<String>,
384389
}
385390

386391
#[derive(Deserialize, Serialize)]
@@ -637,6 +642,7 @@ mod tests {
637642
announcement_addresses = ["54.3.7.81:3001"]
638643
rest_service_address = "127.0.0.1:3002"
639644
alias = "LDK Server"
645+
rgs_server_url = "https://rapidsync.lightningdevkit.org/snapshot/v2/"
640646
641647
[tls]
642648
cert_path = "/path/to/tls.crt"
@@ -750,6 +756,7 @@ mod tests {
750756
rpc_user: "bitcoind-testuser".to_string(),
751757
rpc_password: "bitcoind-testpassword".to_string(),
752758
},
759+
rgs_server_url: Some("https://rapidsync.lightningdevkit.org/snapshot/v2/".to_string()),
753760
rabbitmq_connection_string: expected_rabbit_conn,
754761
rabbitmq_exchange_name: expected_rabbit_exchange,
755762
lsps2_service_config: Some(LSPS2ServiceConfig {
@@ -776,6 +783,7 @@ mod tests {
776783
assert_eq!(config.rest_service_addr, expected.rest_service_addr);
777784
assert_eq!(config.storage_dir_path, expected.storage_dir_path);
778785
assert_eq!(config.chain_source, expected.chain_source);
786+
assert_eq!(config.rgs_server_url, expected.rgs_server_url);
779787
assert_eq!(config.rabbitmq_connection_string, expected.rabbitmq_connection_string);
780788
assert_eq!(config.rabbitmq_exchange_name, expected.rabbitmq_exchange_name);
781789
#[cfg(feature = "experimental-lsps2-support")]
@@ -1069,6 +1077,7 @@ mod tests {
10691077
rpc_user: args_config.bitcoind_rpc_user.unwrap(),
10701078
rpc_password: args_config.bitcoind_rpc_password.unwrap(),
10711079
},
1080+
rgs_server_url: None,
10721081
rabbitmq_connection_string: String::new(),
10731082
rabbitmq_exchange_name: String::new(),
10741083
lsps2_service_config: None,
@@ -1083,6 +1092,7 @@ mod tests {
10831092
assert_eq!(config.rest_service_addr, expected.rest_service_addr);
10841093
assert_eq!(config.storage_dir_path, expected.storage_dir_path);
10851094
assert_eq!(config.chain_source, expected.chain_source);
1095+
assert_eq!(config.rgs_server_url, expected.rgs_server_url);
10861096
assert_eq!(config.rabbitmq_connection_string, expected.rabbitmq_connection_string);
10871097
assert_eq!(config.rabbitmq_exchange_name, expected.rabbitmq_exchange_name);
10881098
assert!(config.lsps2_service_config.is_none());
@@ -1160,6 +1170,7 @@ mod tests {
11601170
rpc_user: args_config.bitcoind_rpc_user.unwrap(),
11611171
rpc_password: args_config.bitcoind_rpc_password.unwrap(),
11621172
},
1173+
rgs_server_url: Some("https://rapidsync.lightningdevkit.org/snapshot/v2/".to_string()),
11631174
rabbitmq_connection_string: expected_rabbit_conn,
11641175
rabbitmq_exchange_name: expected_rabbit_exchange,
11651176
lsps2_service_config: Some(LSPS2ServiceConfig {
@@ -1185,6 +1196,7 @@ mod tests {
11851196
assert_eq!(config.rest_service_addr, expected.rest_service_addr);
11861197
assert_eq!(config.storage_dir_path, expected.storage_dir_path);
11871198
assert_eq!(config.chain_source, expected.chain_source);
1199+
assert_eq!(config.rgs_server_url, expected.rgs_server_url);
11881200
assert_eq!(config.rabbitmq_connection_string, expected.rabbitmq_connection_string);
11891201
assert_eq!(config.rabbitmq_exchange_name, expected.rabbitmq_exchange_name);
11901202
#[cfg(feature = "experimental-lsps2-support")]

0 commit comments

Comments
 (0)