Use channel's real funding amounts when processing RGS data#3924
Conversation
|
👋 Thanks for assigning @jkczyz as a reviewer! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3924 +/- ##
==========================================
+ Coverage 88.83% 89.56% +0.73%
==========================================
Files 166 166
Lines 119259 128662 +9403
Branches 119259 128662 +9403
==========================================
+ Hits 105940 115241 +9301
- Misses 10992 11032 +40
- Partials 2327 2389 +62 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
🔔 1st Reminder Hey @jkczyz! This PR has been waiting for your review. |
|
👋 The first review has been submitted! Do you think this PR is ready for a second reviewer? If so, click here to assign a second reviewer. |
7ac02a6 to
7ad6364
Compare
|
Fixed the spurious error acceptance: $ git diff-tree -U2 7ac02a625 7ad6364ab
diff --git a/lightning-rapid-gossip-sync/src/processing.rs b/lightning-rapid-gossip-sync/src/processing.rs
index 7670147ef7..002807414b 100644
--- a/lightning-rapid-gossip-sync/src/processing.rs
+++ b/lightning-rapid-gossip-sync/src/processing.rs
@@ -275,5 +275,6 @@ where
let mut cursor = &additional_data[..];
let funding_sats_read: Result<BigSize, _> = Readable::read(&mut cursor);
- funding_sats = funding_sats_read.map(|sats| Some(sats.0)).unwrap_or(None);
+ funding_sats =
+ funding_sats_read.map(|sats| Some(sats.0)).ok_or(DecodeError::InvalidValue)?;
if !cursor.is_empty() {
log_gossip!( |
tnull
left a comment
There was a problem hiding this comment.
Seems CI is unhappy:
error[E0599]: no method named `ok_or` found for enum `Result` in the current scope
--> lightning-rapid-gossip-sync/src/processing.rs:278:49
|
278 | funding_sats_read.map(|sats| Some(sats.0)).ok_or(DecodeError::InvalidValue)?;
| ^^^^^ method not found in `Result<std::option::Option<u64>, lightning::ln::msgs::DecodeError>`
|
note: the method `ok_or` exists on the type `std::option::Option<u64>`
help: use the `?` operator to extract the `std::option::Option<u64>` value, propagating a `Result::Err` value to the caller
|
278 | funding_sats_read.map(|sats| Some(sats.0))?.ok_or(DecodeError::InvalidValue)?;
| +
For more information about this error, try `rustc --explain E0599`.
error: could not compile `lightning-rapid-gossip-sync` due to previous error
Neither `channel_announcement`s nor `channel_update`s contain a channel's actual funding amount, complicating scoring as nodes may set an `htlc_maximum_msat` to something less than the funding amount. When scoring, we use `htlc_maximum_msat` anyway if we don't know the funding amount, but its not a perfect proxy. In lightningdevkit/rapid-gossip-sync-server#102 we started including a channel's real funding amount in RGS data, and here we start parsing it and including it in our network graph. Fixes lightningdevkit#1559
7ad6364 to
3775686
Compare
|
Ugh, sorry: $ git diff-tree -U2 7ad6364ab 37756867a
diff --git a/lightning-rapid-gossip-sync/src/processing.rs b/lightning-rapid-gossip-sync/src/processing.rs
index 002807414b..8319506b57 100644
--- a/lightning-rapid-gossip-sync/src/processing.rs
+++ b/lightning-rapid-gossip-sync/src/processing.rs
@@ -274,7 +274,6 @@ where
let additional_data: Vec<u8> = Readable::read(read_cursor)?;
let mut cursor = &additional_data[..];
- let funding_sats_read: Result<BigSize, _> = Readable::read(&mut cursor);
- funding_sats =
- funding_sats_read.map(|sats| Some(sats.0)).ok_or(DecodeError::InvalidValue)?;
+ let funding_sats_read: BigSize = Readable::read(&mut cursor)?;
+ funding_sats = Some(funding_sats_read.0);
if !cursor.is_empty() {
log_gossip!( |
|
Landing this as trivial. I did test against the now-updated mainnet server and it does get funding amounts into the network graph. |
Neither
channel_announcements norchannel_updates contain a channel's actual funding amount, complicating scoring as nodes may set anhtlc_maximum_msatto something less than the funding amount. When scoring, we usehtlc_maximum_msatanyway if we don't know the funding amount, but its not a perfect proxy.In
lightningdevkit/rapid-gossip-sync-server#102 we started including a channel's real funding amount in RGS data, and here we start parsing it and including it in our network graph.
Fixes #1559