multi: use minimal policy in cache

This commit is contained in:
Oliver Gugger
2021-09-21 19:18:22 +02:00
parent 15d3f62d5e
commit 1d1c42f9ba
19 changed files with 629 additions and 227 deletions

View File

@@ -93,9 +93,9 @@ func (m *SessionSource) NewPaymentSessionEmpty() PaymentSession {
// RouteHintsToEdges converts a list of invoice route hints to an edge map that
// can be passed into pathfinding.
func RouteHintsToEdges(routeHints [][]zpay32.HopHint, target route.Vertex) (
map[route.Vertex][]*channeldb.ChannelEdgePolicy, error) {
map[route.Vertex][]*channeldb.CachedEdgePolicy, error) {
edges := make(map[route.Vertex][]*channeldb.ChannelEdgePolicy)
edges := make(map[route.Vertex][]*channeldb.CachedEdgePolicy)
// Traverse through all of the available hop hints and include them in
// our edges map, indexed by the public key of the channel's starting
@@ -125,9 +125,12 @@ func RouteHintsToEdges(routeHints [][]zpay32.HopHint, target route.Vertex) (
// Finally, create the channel edge from the hop hint
// and add it to list of edges corresponding to the node
// at the start of the channel.
edge := &channeldb.ChannelEdgePolicy{
Node: endNode,
ChannelID: hopHint.ChannelID,
edge := &channeldb.CachedEdgePolicy{
ToNodePubKey: func() route.Vertex {
return endNode.PubKeyBytes
},
ToNodeFeatures: lnwire.EmptyFeatureVector(),
ChannelID: hopHint.ChannelID,
FeeBaseMSat: lnwire.MilliSatoshi(
hopHint.FeeBaseMSat,
),