mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 14:11:04 +02:00
routing: use distinct probability estimation for local channels
Previously we used the a priori probability also for our own untried channels. This led to local channels that had seen a success already being prioritized over untried local channels. In some cases, depending on the configured payment attempt cost, this could lead to the payment taking a two hop route while a direct payment was also possible.
This commit is contained in:
@@ -118,6 +118,9 @@ type MissionControlConfig struct {
|
||||
// probability completely and only base the probability on historical
|
||||
// results, unless there are none available.
|
||||
AprioriWeight float64
|
||||
|
||||
// SelfNode is our own pubkey.
|
||||
SelfNode route.Vertex
|
||||
}
|
||||
|
||||
// TimedPairResult describes a timestamped pair result.
|
||||
@@ -261,6 +264,11 @@ func (m *MissionControl) GetProbability(fromNode, toNode route.Vertex,
|
||||
now := m.now()
|
||||
results := m.lastPairResult[fromNode]
|
||||
|
||||
// Use a distinct probability estimation function for local channels.
|
||||
if fromNode == m.cfg.SelfNode {
|
||||
return m.estimator.getLocalPairProbability(now, results, toNode)
|
||||
}
|
||||
|
||||
return m.estimator.getPairProbability(now, results, toNode, amt)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user