channeldb: fix crash when inbound policy is unset

This commit is contained in:
Andras Banki-Horvath 2021-11-01 19:47:09 +01:00 committed by Olaoluwa Osuntokun
parent b99157efbe
commit ea5d43a2a8
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306

View File

@ -405,9 +405,12 @@ func (c *ChannelGraph) ForEachNodeChannel(tx kvdb.RTx, node route.Vertex,
dbCallback := func(tx kvdb.RTx, e *ChannelEdgeInfo, p1,
p2 *ChannelEdgePolicy) error {
cachedInPolicy := NewCachedPolicy(p2)
cachedInPolicy.ToNodePubKey = toNodeCallback
cachedInPolicy.ToNodeFeatures = toNodeFeatures
var cachedInPolicy *CachedEdgePolicy
if p2 != nil {
cachedInPolicy = NewCachedPolicy(p2)
cachedInPolicy.ToNodePubKey = toNodeCallback
cachedInPolicy.ToNodeFeatures = toNodeFeatures
}
directedChannel := &DirectedChannel{
ChannelID: e.ChannelID,