-
Notifications
You must be signed in to change notification settings - Fork 370
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
Pass RoutingFees
to channel_penalty_msat
#2509
Comments
so change the signature to fn channel_penalty_msat(
&self, short_channel_id: u64, source: &NodeId, target: &NodeId, usage: ChannelUsage, score_params: &Self::ScoreParams, routing_fees: &RoutingFees
) -> u64; and then pass |
Should we rather add a single field to @jbesraa also noticed that |
I'm open to either, though I don't really buy that there's anything a scorer shouldn't care about - what if a user decides that nodes with zero base fee tend to be less balanced overall as they get rebalancing traffic through them (just speculating, though I honestly wouldn't be surprised) and wants to score based on it? |
I don't have a strong opinion either. But it has the potential to be a little confusing given the context. These are the fees advertised by the channel, but the context is the usage of the channel for a particular amount. I guess we could always do both (possibly later). The need for the fees charged in |
I mean its pretty trivial to just go ahead and provide both now, would that make it less confusing to you? We could alternatively, instead of just providing a
Ah, yes, we'd previously talked about removing all the fee + score aggregation in the router and just giving that info to the scorer and letting the scorer use the fee information (or not!) to build the aggregate score. I was actually not looking to address that here, the issue is I wanted to do more aggressive filtering by per-hop fess locally, as an easy way to get #2417, but without the the weird path-missing behavior that you kinda get stuck with with any non-backtracking version of second-parameter limiting in Dijkstra's. In general, ISTM in general that any info we already have while doing routing should kinda just be passed to the scorer cause users may want it for any number of hairbrained reasons. |
Yeah, potentially or just make sure the
Probably the
Do we consider the
Yeah, that's fair assuming we consider |
Hmm? |
Gotcha. I'd be a bit more inclined to settle on Forming |
Yea, I think that makes sense - want to give that a go @jbesraa? |
yup yup |
for implementing the source and target functions we would need a bit more info in | 14 pub enum CandidateRouteHop<'a> {
13 /// A hop from the payer, where the outbound liquidity is known.
12 FirstHop {
11 details: &'a ChannelDetails,
| 10 node_id: &'a NodeId
9 },
8 /// A hop found in the [`ReadOnlyNetworkGraph`], where the channel capacity may be unknown.
7 PublicHop {
6 info: DirectedChannelInfo<'a>,
5 short_channel_id: u64,
4 },
3 /// A hop to the payee found in the BOLT 11 payment invoice, though not necessarily a direct
2 /// channel.
1 PrivateHop {
971 hint: &'a RouteHintHop,
| 1 target_node_id: &'a NodeId,
2 },
3 /// The payee's identity is concealed behind blinded paths provided in a BOLT 12 invoice.
4 Blinded {
5 hint: &'a (BlindedPayInfo, BlindedPath),
6 hint_idx: usize,
7 },
8 /// Similar to [`Self::Blinded`], but the path here has 1 blinded hop. `BlindedPayInfo` provided
9 /// for 1-hop blinded paths is ignored because it is meant to apply to the hops *between* the
10 /// introduction node and the destination. Useful for tracking that we need to include a blinded
11 /// path at the end of our [`Route`].
12 OneHopBlinded {
13 hint: &'a (BlindedPayInfo, BlindedPath),
14 hint_idx: usize,
15 },
16 } | 1080 fn source(&self) -> &NodeId {
| 1 match self {
| 2 CandidateRouteHop::FirstHop { details, node_id } => node_id,
| 3 CandidateRouteHop::PublicHop { info, .. } => &info.channel.node_one.into(),
| 4 CandidateRouteHop::PrivateHop { hint, ..} => &hint.src_node_id.into(),
| 5 CandidateRouteHop::Blinded { hint, .. } => &hint.1.introduction_node_id.into(),
| 6 CandidateRouteHop::OneHopBlinded { hint, .. } => &hint.1.introduction_node_id.into()
| 7 }
| 8 }
| 9 fn target(&self) -> &NodeId {
| 10 match self {
| 11 CandidateRouteHop::FirstHop { details, .. } => &details.counterparty.node_id.into(),
| 12 CandidateRouteHop::PublicHop { info, .. } => &info.channel.node_two.into(),
| 13 CandidateRouteHop::PrivateHop { hint, target_node_id } => target_node_id,
| 14 CandidateRouteHop::Blinded { hint, .. } => &hint.1.blinding_point.into(),
| 15 CandidateRouteHop::OneHopBlinded { hint, .. } => &hint.1.blinding_point.into()
| 16 }
| 17 } |
Yeah, though I think we may need to have |
yea was wondering about that, why then the current |
so the so for exmaple in this impl i get the errors marked as 19 impl<G: Deref<Target = NetworkGraph<L>>, L: Deref, T: Time> ScoreLookUp for ProbabilisticScorerUsingTime<G, L, T> where L::Target: Logger {
18 type ScoreParams = ProbabilisticScoringFeeParameters;
17 fn channel_penalty_msat(
| 16 &self, candidate: CandidateRouteHop, usage: ChannelUsage, score_params: &ProbabilisticScoringFeeParameters
15 ) -> u64 {
>> 14 if let Some(penalty) = score_params.manual_node_penalties.get(candidate.target()) {
13 return *penalty;
12 }
11
10 let base_penalty_msat = score_params.base_penalty_msat.saturating_add(
9 score_params.base_penalty_amount_multiplier_msat
8 .saturating_mul(usage.amount_msat) / BASE_AMOUNT_PENALTY_DIVISOR);
7
6 let mut anti_probing_penalty_msat = 0;
5 match usage.effective_capacity {
4 EffectiveCapacity::ExactLiquidity { liquidity_msat: amount_msat } |
3 EffectiveCapacity::HintMaxHTLC { amount_msat } =>
2 {
1 if usage.amount_msat > amount_msat {
1207 return u64::max_value();
1 } else {
2 return base_penalty_msat;
3 }
4 },
5 EffectiveCapacity::Total { capacity_msat, htlc_maximum_msat } => {
6 if htlc_maximum_msat >= capacity_msat/2 {
7 anti_probing_penalty_msat = score_params.anti_probing_penalty_msat;
8 }
9 },
10 _ => {},
11 }
12
13 let amount_msat = usage.amount_msat;
14 let capacity_msat = usage.effective_capacity.as_msat();
15 let inflight_htlc_msat = usage.inflight_htlc_msat;
16 self.channel_liquidities
>> 17 .get(&candidate.short_channel_id())
18 .unwrap_or(&ChannelLiquidity::new())
>> 19 .as_directed(candidate.source(), candidate.target(), inflight_htlc_msat, capacity_msat, self.decay_params)
20 .penalty_msat(amount_msat, score_params)
21 .saturating_add(anti_probing_penalty_msat)
22 .saturating_add(base_penalty_msat)
23 }
24 }
|
Hmm... I guessing the router will never call the scorer in those cases. But it's weird that |
Oops, I think the current code re: blinded paths is kinda buggy, it currently calls the scorer with |
This can help in some custom filtering based on fees, and there's very little cost to this - we already have the fees available! Should be as simple as just adding a new parameter to the trait function and making it compile.
The text was updated successfully, but these errors were encountered: