Skip to content

Specify whether we have first-hop hints when routing #1309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

This is incredibly useful when debugging issues with the router,
and is somewhat of an oversight currently.

payment_params.payee_pubkey, if allow_mpp { "with" } else { "without" });
log_trace!(logger, "Searching for a route from payer {} to payee {} {} MPP and {} first hops {}overriding the network graph", our_node_pubkey,
payment_params.payee_pubkey, if allow_mpp { "with" } else { "without" },
if first_hops.is_some() { first_hops.as_ref().unwrap().len() } else { 0 }, if first_hops.is_some() { "" } else { "not " });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think since we have the 0, can't we get rid of if first_hops.is_some() { "" } else { "not " }?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The behavior is different between Some(0 length) and None, though - Some(0 length) will always fail to route, None will look at the network graph.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I think we should error at the beginning of the method for that first case then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean we do error, indicating that we have no path to use. I guess we could update the error message as well, but its nice to log the info as well because users may or may not log specific error messages, relying on our own logs instead (which is kinda annoying, but seems to be a recurring problem).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it does already get its own error message Cannot route when there are no outbound routes away from us is unique to this case.

@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2022

Codecov Report

Merging #1309 (0844ba9) into main (963f8d9) will increase coverage by 0.39%.
The diff coverage is 100.00%.

❗ Current head 0844ba9 differs from pull request most recent head 637e0d3. Consider uploading reports for the commit 637e0d3 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1309      +/-   ##
==========================================
+ Coverage   90.51%   90.90%   +0.39%     
==========================================
  Files          71       72       +1     
  Lines       39210    41971    +2761     
==========================================
+ Hits        35490    38155    +2665     
- Misses       3720     3816      +96     
Impacted Files Coverage Δ
lightning/src/routing/router.rs 91.92% <100.00%> (+0.13%) ⬆️
lightning/src/util/scid_utils.rs 98.58% <0.00%> (-1.42%) ⬇️
lightning/src/ln/functional_tests.rs 97.07% <0.00%> (-0.04%) ⬇️
lightning/src/util/crypto.rs 100.00% <0.00%> (ø)
lightning-invoice/src/de.rs 81.27% <0.00%> (+0.20%) ⬆️
lightning/src/chain/keysinterface.rs 96.15% <0.00%> (+0.29%) ⬆️
lightning/src/ln/onion_utils.rs 96.05% <0.00%> (+0.41%) ⬆️
lightning-invoice/src/lib.rs 88.24% <0.00%> (+0.82%) ⬆️
lightning/src/util/test_utils.rs 83.78% <0.00%> (+1.52%) ⬆️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 963f8d9...637e0d3. Read the comment docs.

jkczyz
jkczyz previously approved these changes Feb 18, 2022
This is incredibly useful when debugging issues with the router,
and is somewhat of an oversight currently.
@TheBlueMatt
Copy link
Collaborator Author

Squashed without diff:

$ git diff-tree -U1 0844ba9e6 637e0d34c
$

@valentinewallace valentinewallace merged commit 23f1ec8 into lightningdevkit:main Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants