multi: move bandwidth hints behind interface

This commit is contained in:
carla
2021-10-19 09:37:44 +02:00
parent e6c65f1cbd
commit 45de686d35
15 changed files with 369 additions and 134 deletions

View File

@@ -19,12 +19,12 @@ type SessionSource struct {
// and also to carry out path finding queries.
Graph routingGraph
// QueryBandwidth is a method that allows querying the lower link layer
// GetLink is a method that allows querying the lower link layer
// to determine the up to date available bandwidth at a prospective link
// to be traversed. If the link isn't available, then a value of zero
// should be returned. Otherwise, the current up to date knowledge of
// the available bandwidth of the link should be returned.
QueryBandwidth func(*channeldb.DirectedChannel) lnwire.MilliSatoshi
GetLink getLinkQuery
// MissionControl is a shared memory of sorts that executions of payment
// path finding use in order to remember which vertexes/edges were
@@ -47,12 +47,10 @@ type SessionSource struct {
func (m *SessionSource) NewPaymentSession(p *LightningPayment) (
PaymentSession, error) {
getBandwidthHints := func() (map[uint64]lnwire.MilliSatoshi,
error) {
sourceNode := m.Graph.sourceNode()
return generateBandwidthHints(
m.Graph.sourceNode(), m.Graph, m.QueryBandwidth,
)
getBandwidthHints := func() (bandwidthHints, error) {
return newBandwidthManager(m.Graph, sourceNode, m.GetLink)
}
session, err := newPaymentSession(