-
Notifications
You must be signed in to change notification settings - Fork 379
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
Add CandidateRouteHop to channel_penalty_msat inputs #2551
Add CandidateRouteHop to channel_penalty_msat inputs #2551
Conversation
208e443
to
22f9a75
Compare
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2551 +/- ##
==========================================
- Coverage 88.62% 88.48% -0.14%
==========================================
Files 115 115
Lines 90446 90309 -137
Branches 90446 90309 -137
==========================================
- Hits 80156 79912 -244
- Misses 7883 7996 +113
+ Partials 2407 2401 -6 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This looks pretty good, thanks for doing this.
lightning/src/routing/router.rs
Outdated
hint: &'a (BlindedPayInfo, BlindedPath), | ||
/// The index of the hint in the original list of blinded hints. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of the docs could use a bit more detail - in general, docs should list (a) what it is, (b) when and why a user would want to use it, and (c) how a user would use it. For example, here, we should say something about how this exists to give each possible CandidateRouteHop
a unique ID for the duration of a given routefinding call.
Apologies for the delay here. I suspect ill only have time to revisit this during the weekend. |
No particular rush. Given how close we are to 0.0.117 we may not get this over the line anyway, so it may need to wait three weeks. |
4bd2037
to
ffd7463
Compare
pushed some changes but this still WIP |
ffd7463
to
28f7b42
Compare
lightning/src/routing/router.rs
Outdated
/// Returns short_channel_id if known. | ||
/// For `FirstHop` we assume `get_outbound_payment_scid` is always set, this assumption is checked in | ||
/// `find_route` method. | ||
/// For `Blinded` and `OneHopBlinded` we return None because we don't know the channel id. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/we don't know the channel id/the next hop is blinded
lightning/src/routing/router.rs
Outdated
let target = match candidate.target() { | ||
Some(target) => target, | ||
None => return 0, | ||
}; | ||
let short_channel_id = match candidate.short_channel_id() { | ||
Some(short_channel_id) => short_channel_id, | ||
None => return 0, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should return 0 here. Rather, it would be better to have these cases delegate to the underlying scorer just like in the else
clause below.
lightning/src/util/test_utils.rs
Outdated
}; | ||
let channel = match channel.as_directed_to(&NodeId::from_pubkey(&hop.pubkey)) { | ||
Some(channel) => channel, | ||
None => continue, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a panic, I think.
lightning/src/util/test_utils.rs
Outdated
@@ -1359,4 +1389,4 @@ impl WalletSource for TestWalletSource { | |||
} | |||
Ok(tx) | |||
} | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline needed
lightning/src/routing/router.rs
Outdated
@@ -1228,7 +1224,7 @@ fn iter_equal<I1: Iterator, I2: Iterator>(mut iter_a: I1, mut iter_b: I2) | |||
pub struct PathBuildingHop<'a> { | |||
// Note that this should be dropped in favor of loading it from CandidateRouteHop, but doing so | |||
// is a larger refactor and will require careful performance analysis. | |||
node_id: NodeId, | |||
// node_id: NodeId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove commented out code here and elsewhere. The comment above can also be dropped now.
262ac35
to
6ca3010
Compare
@jkczyz @TheBlueMatt thanks for the review. I reverted back the last commit (removing well, now after writing it, thats not correct, right? |
From the perspective of scoring, the payment is moving from the But the routing algorithm is working backwards from the recipient to the sender. When it calls Anyhow, that's a long way of saying that the rust-lightning/lightning/src/routing/router.rs Line 1860 in 9b1b724
You may want to add an assert there to confirm they are the same before removing it. |
8e4aa27
to
1bc8326
Compare
thank you @jkczyz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the delay. We were focused on the 117 release and were traveling for an offsite.
Some of these comments will need to be applied wherever relevant.
lightning/src/routing/gossip.rs
Outdated
channel: &'a ChannelInfo, | ||
/// Provides information about a channel between two nodes. | ||
pub channel: &'a ChannelInfo, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be pub
?
lightning/src/routing/scoring.rs
Outdated
@@ -2548,32 +2553,40 @@ mod tests { | |||
inflight_htlc_msat: 0, | |||
effective_capacity: EffectiveCapacity::Total { capacity_msat: 1_024_000, htlc_maximum_msat: 1_000 }, | |||
}; | |||
assert_eq!(scorer.channel_penalty_msat(42, &source, &target, usage, ¶ms), 0); | |||
let channel = network_graph.read_only().channel(42).unwrap().to_owned(); | |||
let (info, target) = channel.as_directed_from(&source).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the scoring tests, the target
here is shadowing an earlier target
, but neither are used resulting in a build warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this was resolved in some of the other tests, but not here.
lightning/src/routing/scoring.rs
Outdated
@@ -2548,32 +2553,40 @@ mod tests { | |||
inflight_htlc_msat: 0, | |||
effective_capacity: EffectiveCapacity::Total { capacity_msat: 1_024_000, htlc_maximum_msat: 1_000 }, | |||
}; | |||
assert_eq!(scorer.channel_penalty_msat(42, &source, &target, usage, ¶ms), 0); | |||
let channel = network_graph.read_only().channel(42).unwrap().to_owned(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we avoid the to_owned
here by adding another variable for the read-only graph? Otherwise, this is performing a clone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some places I was able to take out the to_owned
but in others, I couldnt as I got an error saying the lock is not free. how is that possible when we are using RwLock
, cant multiple functions read from the lock in the same time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need something like this:
let network_graph = network_graph.read_only();
let channel = network_graph.channel(42).unwrap();
Hard to say why it would sometimes work without the extra variable without seeing an example.
lightning/src/routing/scoring.rs
Outdated
source_node_id: node_a, | ||
target_node_id: *target | ||
}; | ||
// assert_eq!(scorer.channel_penalty_msat(42, &node_a, &node_b, usage, ¶ms), 128); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove commented out code.
lightning/src/routing/scoring.rs
Outdated
|
||
let channel = network_graph.read_only().channel(42).unwrap().to_owned(); | ||
let (info, target) = channel.as_directed_from(&node_a).unwrap(); | ||
let candidate: CandidateRouteHop = CandidateRouteHop::PublicHop { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't need the type declaration.
lightning/src/routing/scoring.rs
Outdated
liquidity_penalty_multiplier_msat: 1_000, | ||
liquidity_penalty_amount_multiplier_msat: 0, | ||
..ProbabilisticScoringFeeParameters::zero_penalty() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea will go through the indentation problems.. I started this pr on a linux machine and now trying to finish it on a mac and the linting is driving me crazy (: cant wait for #2648!
lightning/src/routing/router.rs
Outdated
/// `BlindedPayInfo` provides information needed about the | ||
/// payment while routing through a blinded | ||
/// path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you wrap all docs at 100 characters?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
max 100 chars in a single line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, though I guess now that is defined with tabs may be ambiguous. I just go with the smallest number vim gives.
Note that we aren't really consistent with that currently with long lines. Though, I don't think we should deliberately make the length of comments shorter.
lightning/src/routing/router.rs
Outdated
}, | ||
/// The payee's identity is concealed behind blinded paths provided in a BOLT 12 invoice. | ||
Blinded { | ||
/// Hint provides information about a blinded hop, needed while routing through a blinded | ||
/// channel. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/channel/path
lightning/src/routing/router.rs
Outdated
/// The node id of current hop in route. | ||
/// | ||
/// This will always equal to `maybe_dummy_payee_node_id` in `find_route` method. | ||
target_node_id: NodeId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't reference maybe_dummy_payee_node_id
in the docs given it is a local variable. Why do we need a field for this anyway if it could be a constant?
Also, it seems this a routing concern whereas it shouldn't be applicable to scoring. Given we are using the struct in two contexts, I think we need to decide if we want to expose the constant or use an Option
. @TheBlueMatt Any thoughts on this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, we should simply remove it and expose the target as an option. We may want to have a private version that always returns the dummy that is only used in router.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok few questions here because this thing is a kinda big.
add_entry!
macro have also target
and source
inputs as well as Candidate
- after adding fn target
and fn source
to Candidate
, we should remove the source and target from add_entry!
correct?
regarding maybe_dummy_payee_node_id
, should I always run candidate.target().unwrap_or(maybe_dummy_payee_node_id)
?
we have this bit
if ordered_hops.last().unwrap().0.candidate.target().unwrap() == maybe_dummy_payee_node_id
we cant keep it like this as its not correct, should I do if ....candidate.target().is_none()....
?
last question (:
the id
function takes a direction as an input which is sourc < target
should I keep that input as is or make it optional? because we have some places in the code were we call it with source < target
but other places where we just give true/false
..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pushed some code with the stuff I mentioned in prev comment^.. please let me know what u think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the question regarding the id
function is because we dont need to provide source < target
now because Candidate
has this info (see code please)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok few questions here because this thing is a kinda big.
add_entry!
macro have alsotarget
andsource
inputs as well asCandidate
- after addingfn target
andfn source
toCandidate
, we should remove the source and target fromadd_entry!
correct?
Ideally, yes, though there is the blinded case that needs to be considered, as you mention below.
regarding
maybe_dummy_payee_node_id
, should I always runcandidate.target().unwrap_or(maybe_dummy_payee_node_id)
? we have this bitif ordered_hops.last().unwrap().0.candidate.target().unwrap() == maybe_dummy_payee_node_id
we cant keep it like this as its not correct, should I doif ....candidate.target().is_none()....
?
maybe_dummy_payee_node_id
always seemed a little hacky to me. @TheBlueMatt Is there any reason we can't check against None
instead?
last question (: the
id
function takes a direction as an input which issourc < target
should I keep that input as is or make it optional? because we have some places in the code were we call it withsource < target
but other places where we just givetrue/false
..
Huh, it's kinda error-prone that it takes a direction in the first place given the source
and target
relationship is what defines the direction (i.e., a candidate's direction, and thus id, should never change). So someone could mix it up if they need to pass it in. Seems like the direction could be derived from the candidate now, though.
Looks like we pass in true
or false
when we need a CandidateHopId
in both directions, though we could add a method to CandidateHopId
that gives the CandidateHopId
for the opposite direction. That way, we should never need to pass in a direction to obtain a candidate's id.
Also, we use true
unilaterally in some places, which seems wrong? Or maybe it just doesn't matter at that point and we need some id, if not the most accurate one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe_dummy_payee_node_id always seemed a little hacky to me. @TheBlueMatt Is there any reason we can't check against None instead?
I think we largely could. Now that we're moving away from storing a destination in the PathBuildingHop
we could drop it and use an option. Its still a bit strange to use an option, though, imo - we're then using None
to mean "the blinded path introduction point(s)", which is fine, but that needs to mean only that, if we ever have some other use for a None
target that would conflict. Thus I don't really have a strong feeling on changing it, though if we dont we should have an internal-only version of target
which returns the dummy rather than doing it at the callsite.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see... yeah, hard to say what's best. Having an internal target
function returning NodeId
instead of Option<NodeId>
may be better so it's all defined in one place then (opposed to unwrap_or(maybe_dummy_payee_node_id)
). But there are places where we expect the candidate to not be blinded, so it's questionable if we should be replacing those with maybe_dummy_payee_node_id
. I left some comments where this may be the case or where maybe_dummy_payee_node_id
isn't strictly necessary. @jbesraa Let's see what remains after addressing those comments.
lightning/src/routing/router.rs
Outdated
/// Returns the id of this hop. | ||
/// For `Blinded` and `OneHopBlinded` we return `CandidateHopId::Blinded` because we don't know the channel id. | ||
/// For any other option we return `CandidateHopId::Clear` because we know the channel id and the direction. | ||
pub fn id(&self, channel_direction: bool /* src_node_id < target_node_id */) -> CandidateHopId { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to be pub
? If so, we should document channel_direction
in the method docs. I'd rather not expose this detail if we don't need to, though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I am not mistaken, @TheBlueMatt wanted this to be pub
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, is that referring to #2551 (comment) ? I'd at least like to rid ourselves of the direction parameter if we want to expose it for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd suggested making it pub since I was thinking we just make everything pub. But, I think @jkczyz is right here, there's not a real use for this for scorer users.
122ca61
to
1c0c656
Compare
75309a9
to
f9fac0b
Compare
rearranged commits and fixed up some, hopefully its a bit nicer to review |
lightning/src/routing/scoring.rs
Outdated
//! # fn find_scored_route(payer: PublicKey, route_params: RouteParameters, network_graph: NetworkGraph<&FakeLogger>) { | ||
//! # let logger = FakeLogger {}; | ||
//! # | ||
//! extern crate bitcoin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to enable this test as it was failing for me locally when running ci checks.. should I move this to a different commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The #
marks simply hide the code from the rust docs. It shouldn't affect the test result, so it should remain as it was. Do you have the failure message?
8fc961a
to
8383e3f
Compare
@jkczyz thank for the ongoing review! |
8383e3f
to
38c5592
Compare
rebased against main, no changes |
38c5592
to
2cfff78
Compare
pushed with verified commits, no code changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for sticking with this! I think this is shaping up.
lightning/src/routing/router.rs
Outdated
@@ -993,44 +993,74 @@ impl cmp::PartialOrd for RouteGraphNode { | |||
|
|||
/// A wrapper around the various hop representations. | |||
/// | |||
/// Used to construct a [`PathBuildingHop`] and to estimate [`EffectiveCapacity`]. | |||
/// Used to construct a `PathBuildingHop` and to estimate [`EffectiveCapacity`]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's updated the docs to not refer to an internal struct and instead talk to how it is used externally.
/// Returns the id of this hop. | ||
/// For `Blinded` and `OneHopBlinded` we return `CandidateHopId::Blinded` with `hint_idx` because we don't know the channel id. | ||
/// For any other option we return `CandidateHopId::Clear` because we know the channel id and the direction. | ||
pub fn id(&self) -> CandidateHopId { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we settle on keeping this private?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I don't care, as long as it doesn't have the second argument, which it now doesn't, which is nice. It does seem like it could be useful, but its also kinda confusing that its only valid on a per-routefinding-basis, rather than globally.
lightning/src/routing/router.rs
Outdated
/// Hint provides information about a blinded hop, | ||
/// needed while routing through a blinded path. `BlindedPayInfo` | ||
/// provides information needed about the | ||
/// payment while routing through a blinded path. | ||
/// `BlindedPath` is the blinded path to the destination. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Here and elsewhere, let's try to wrap comments at 100 characters.
lightning/src/routing/router.rs
Outdated
hint_idx: usize, | ||
}, | ||
/// Similar to [`Self::Blinded`], but the path here has 1 blinded hop. `BlindedPayInfo` provided | ||
/// for 1-hop blinded paths is ignored because it is meant to apply to the hops *between* the | ||
/// introduction node and the destination. Useful for tracking that we need to include a blinded | ||
/// path at the end of our [`Route`]. | ||
OneHopBlinded { | ||
/// Hint provides information about a single blinded hop, | ||
/// needed while routing through a blinded channel. `BlindedPayInfo` is ignored here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/blinded channel/one-hop blinded path
lightning/src/routing/router.rs
Outdated
/// Source node id refers to the hop that is previous | ||
/// to the current examined hop in route finding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of phrasing in terms of route finding -- which actually starts at the recipient and works backwards -- let's phrase in terms of scoring a channel (i.e., in the direction of the payment).
lightning/src/routing/router.rs
Outdated
if src_node_id != dest_node_id { | ||
if Some($candidate.source()) != $candidate.target() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change this in this commit (or at all)?
lightning/src/routing/router.rs
Outdated
// Update the way of reaching $src_node_id with the given short_channel_id (from $dest_node_id), | ||
// Update the way of reaching $candidate.source() with the given short_channel_id (from $candidate.target()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise, should be in an earlier commit.
lightning/src/routing/scoring.rs
Outdated
@@ -2548,32 +2553,40 @@ mod tests { | |||
inflight_htlc_msat: 0, | |||
effective_capacity: EffectiveCapacity::Total { capacity_msat: 1_024_000, htlc_maximum_msat: 1_000 }, | |||
}; | |||
assert_eq!(scorer.channel_penalty_msat(42, &source, &target, usage, ¶ms), 0); | |||
let channel = network_graph.read_only().channel(42).unwrap().to_owned(); | |||
let (info, target) = channel.as_directed_from(&source).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this was resolved in some of the other tests, but not here.
lightning/src/routing/router.rs
Outdated
// as a way to reach the $dest_node_id. | ||
// as a way to reach the target node id. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update in an earlier commit.
b851626
to
6d7f156
Compare
@jkczyz pushed updates to nits + fixed the git history |
Needs rebase, sorry about that. We should be able to do any remaining cleanups in followups, though. |
If `outband` flag is set to true then `ChannelInfo::node_one` is forwarding a payment to target `ChannelInfo::node_two`. If `outband` flag is set to false then `ChannelInfo::node_two` is forwarding a payment to target `ChannelInfo::node_one`.
`DirectedChannelInfo::source` return the `node_id` of the forwarding hop. `DirectedChannelInfo::target` return the `node_id` of the destination hop.
We add `CandidateRouteHop::source` and `CandidateRouteHop::source` functions to point to current and next hops in route respectively. As we have now `source` and `target` available in `CandidateRouteHop` we also remove `CandidateRouteHop::id` inputs so now they are consumed from `self.target` and `self.source` functions. In the `add_entry` macro we also remove `source` and `target` arguments in favor of `candidate` of type `CandidateRouteHop` that holds the needed info.
Change `short_channel_id`, `cltv_expiry_delta` `fees` and `htlc_minimum_msat` under `CandidateRouteHop` visibility to public and add documentation.
We remove `source`, `target` and `scid` from `channel_penalty_msat` inputs to consume them from `candidate` of type `CandidateRouteHop`
We remove `node_id` from `PathBuildingHop` as we can rely `CandidateRouteHop::target` instead.
6d7f156
to
cbde4a7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of the new docs could use a bit more clarity, but I think the code is all correct and we should land it and do more in a followup.
details: first_hops[idx], | ||
node_id: NodeId::from_pubkey(payer) | ||
}; | ||
scorer.channel_penalty_msat(&candidate, usage, &()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point here is to ensure that the channel_penalty_msat calls mirror those of normal routing operations (at least if we were to select the first path we find). Here you've changed it so that we only call channel_penalty_msat
on first-hops, which I don't think accomplishes that goal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch here. Fortunately, we only utilize TestScorer
in one test currently with announced channels. Below it's probably more accurate to fall back to PrivateHop
if the NetworkGraph
does not contain the channel, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can leave these comments for a follow-up.
/// Returns the `node_id` of the source hop. | ||
/// | ||
/// Refers to the `node_id` forwarding the payment to the next hop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just combine this as:
/// Returns the `node_id` forwarding the payment to the next hop.
/// Returns the `node_id` of the target hop. | ||
/// | ||
/// Refers to the `node_id` receiving the payment from the previous hop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar.
/// Returns the source node id of current hop. | ||
/// | ||
/// Source node id refers to the hop forwarding the payment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise here and in target
docs.
Will do a quick followup to address various comments and play with |
Doc and performance followups to #2551
resolves #2509