Allow nodes to be avoided during pathfinding#1550
Allow nodes to be avoided during pathfinding#1550TheBlueMatt merged 1 commit intolightningdevkit:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1550 +/- ##
==========================================
- Coverage 91.04% 91.02% -0.03%
==========================================
Files 80 80
Lines 44034 44072 +38
Branches 44034 44072 +38
==========================================
+ Hits 40091 40115 +24
- Misses 3943 3957 +14
Continue to review full report at Codecov.
|
lightning/src/routing/scoring.rs
Outdated
| write_tlv_fields!(w, { | ||
| (0, self.channel_liquidities, required) | ||
| (0, self.channel_liquidities, required), | ||
| (1, self.banned_nodes, vec_type), |
There was a problem hiding this comment.
Do we need/want to serialize these? I'd imagine they can be explicitly added after parsing or passed in as an arg instead. Presumably a list of such nodes is maintained elsewhere.
There was a problem hiding this comment.
Right, if we want to go that way we'll want to do it via the config argument, but then I guess we'd still keep the methods to edit the set?
There was a problem hiding this comment.
I'd say keep the methods but leave it out of the config, as you have it, since its more of a dynamic setting. I guess the question would then be if it should be included in the ReadableArgs parameter.
lightning/src/routing/scoring.rs
Outdated
| write_tlv_fields!(w, { | ||
| (0, self.channel_liquidities, required) | ||
| (0, self.channel_liquidities, required), | ||
| (1, self.banned_nodes, vec_type), |
There was a problem hiding this comment.
I'd say keep the methods but leave it out of the config, as you have it, since its more of a dynamic setting. I guess the question would then be if it should be included in the ReadableArgs parameter.
5055d9b to
cc13d2b
Compare
|
Squashed commits for now. Let me know if I should re-add some serialization of the banned nodes list, or if it's fine as it is. |
Argument against serializing the banned nodes is that a crash before serialization would result in the list being inaccurate. So I think it should be maintained independently. Regarding using the config for the list (#1550 (comment)), we couldn't use a For |
We could expose add/remove methods and the bindings would work fine, we just couldn't expose the |
TheBlueMatt
left a comment
There was a problem hiding this comment.
I would really like to see the map in the config struct - I think it can improve ergonomics a good bit especially for rust users, but being able to set the whole thing up before deserialization instead of after is kinda nice. Its not a big deal though, if we feel strongly to not do that I can live with it. Looks basically good either way.
Alright, I have no strong opinion on this. |
No strong objections. Having consistency between |
Nah, just have to tag it |
|
So, just to be on the same page about the way forward:
Does that sound about right? Objections/corrections? |
|
SGTM. |
|
lol, thanks, I was starting to wonder what was referred to as 'config' and how I'd access |
| /// | ||
| /// Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel | ||
| /// penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel). | ||
| #[derive(Clone, Copy)] |
There was a problem hiding this comment.
Unfortunately, adding the HashSet here makes this only moveable.
There was a problem hiding this comment.
We can leave Clone, no? Just have to drop Copy.
There was a problem hiding this comment.
Yes, I of course left Clone. Sorry if that was confusing.
|
Still needs to address #1550 (comment) ? |
Ah, thanks, I missed that. Will move (most of) the methods back. |
|
Looks like this needs rebase? |
c69f400 to
937ad6f
Compare
|
Rebased! |
|
LGTM, feel free to squash. |
Users may want to - for whatever reasons - prevent payments to be routed over certain nodes. This change therefore allows to add `NodeId`s to a list of banned nodes, which then will be avoided during path finding.
937ad6f to
57d8257
Compare
|
Squashed. |
Users may want to - for whatever reasons - prevent payments to be routed over certain nodes.
This PR therefore allows to add
NodeIds to a list of banned nodes, which then will be avoided during path finding.