Uh oh!
There was an error while loading. Please reload this page.
Implement configurable GossipSource to allow RGS gossip updates - #70
Conversation
Draft for now, as I have yet to figure out the approach to persisting the latest retrieved timestamp and the chosen gossip configuration. The approach taken should nicely integrate with the greater picture of config persistence (see #4). |
0fbf95a to
6c93102Comparetnull
commented
Apr 26, 2023
Rebased on main. |
d046e12 to
596c5e1Comparetnull
commented
May 9, 2023
Rebased on main after #25 has been merged. Still have to expose RGS config in bindings though. |
jkczyz
commented
May 9, 2023
Would |
596c5e1 to
64cdc07Comparetnull
commented
May 12, 2023
Ah, good point, thank you. I think I tried this before, but at another point. Seems to work now fine and allows us to remove the clutter. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
ac32977 to
244fd42Comparetnull
commented
May 13, 2023
Cleaned up the code a bit and now added persistence of RGS |
Uh oh!
There was an error while loading. Please reload this page.
244fd42 to
2416808CompareNow squashed fixups and included the following changes: iff --git a/src/gossip.rs b/src/gossip.rs
index b94a346..a3c5353 100644
--- a/src/gossip.rs+++ b/src/gossip.rs@@ -1,3 +1,3 @@-use crate::logger::{log_error, log_info, FilesystemLogger, Logger};+use crate::logger::{log_trace, FilesystemLogger, Logger};
use crate::types::{GossipSync, NetworkGraph, P2PGossipSync, RapidGossipSync};
use crate::Error;
@@ -62,11 +62,15 @@ impl GossipSource {
let query_timestamp = latest_sync_timestamp.load(Ordering::Acquire);
let query_url = format!("{}/{}", server_url, query_timestamp);
- let response =- reqwest::get(query_url).await.map_err(|_| Error::GossipUpdateFailed)?;+ let response = reqwest::get(query_url).await.map_err(|e| {+ log_trace!(logger, "Failed to retrieve RGS gossip update: {}", e);+ Error::GossipUpdateFailed+ })?;
match response.error_for_status() {
Ok(res) => {
- let update_data =- res.bytes().await.map_err(|_| Error::GossipUpdateFailed)?;+ let update_data = res.bytes().await.map_err(|e| {+ log_trace!(logger, "Failed to retrieve RGS gossip update: {}", e);+ Error::GossipUpdateFailed+ })?;
let new_latest_sync_timestamp = gossip_sync
@@ -74,9 +78,8 @@ impl GossipSource {
.map_err(|_| Error::GossipUpdateFailed)?;
latest_sync_timestamp.store(new_latest_sync_timestamp, Ordering::Release);
- log_info!(logger, "Successfully retrieved latest gossip update.");
Ok(new_latest_sync_timestamp)
}
Err(e) => {
- log_error!(logger, "Failed to retrieve RGS gossip update: {}", e);+ log_trace!(logger, "Failed to retrieve RGS gossip update: {}", e);
Err(Error::GossipUpdateFailed)
} |
Here we implement a `GossipSource` object that allows us to configure P2P or RGS gossip sources without the need to propagate and leak LDK type parameters upwards. To this end, `GossipSource` wraps the corresponding variants and implements a `RoutingMessageHandler` that is delegating or ignoring the incoming messages.
2416808 to
56262beCompare56262be to
f3aeeeeComparetnull
commented
May 17, 2023
Ah, fixed and squashed another tiny nit: diff --git a/src/io/utils.rs b/src/io/utils.rs
index fefeda1..95ad56b 100644
--- a/src/io/utils.rs+++ b/src/io/utils.rs@@ -211,5 +211,5 @@ where
log_error!(
logger,
- "Writing peer data to key {}/{} failed due to: {}",+ "Writing data to key {}/{} failed due to: {}",
RGS_LATEST_SYNC_TIMESTAMP_NAMESPACE,
RGS_LATEST_SYNC_TIMESTAMP_KEY,
@@ -221,5 +221,5 @@ where
log_error!(
logger,
- "Committing peer data to key {}/{} failed due to: {}",+ "Committing data to key {}/{} failed due to: {}",
RGS_LATEST_SYNC_TIMESTAMP_NAMESPACE,
RGS_LATEST_SYNC_TIMESTAMP_KEY, |
Fixes#2,
Based on #68.Here we implement a
GossipSourceobject that allows us to configure P2P or RGS gossip sources without the need to propagate and leak LDK type parameters upwards. To this end,GossipSourcewraps the corresponding variants and implements aRoutingMessageHandlerthat is delegating or ignoring the incoming messages.