channeldb/graph: fix off-by-one public key slice
In this commit, we fix an off-by-one error when slicing the public key from the serialized node info byte slice. This would cause us to write an extra byte to all edge policies. Even though the values were read correctly, when attempting to calculate the offset of an edge's update time going backwards, we'd always be incorrect, causing us to not properly prune the edge update index.
This commit is contained in:
parent
06344da62e
commit
492d581df6
@ -1644,9 +1644,9 @@ func updateEdgePolicy(edges, edgeIndex *bolt.Bucket,
|
||||
var fromNode, toNode []byte
|
||||
if edge.Flags&lnwire.ChanUpdateDirection == 0 {
|
||||
fromNode = nodeInfo[:33]
|
||||
toNode = nodeInfo[33:67]
|
||||
toNode = nodeInfo[33:66]
|
||||
} else {
|
||||
fromNode = nodeInfo[33:67]
|
||||
fromNode = nodeInfo[33:66]
|
||||
toNode = nodeInfo[:33]
|
||||
}
|
||||
|
||||
@ -3103,7 +3103,7 @@ func fetchChanEdgePolicies(edgeIndex *bolt.Bucket, edges *bolt.Bucket,
|
||||
|
||||
// Similarly, the second node is contained within the latter
|
||||
// half of the edge information.
|
||||
node2Pub := edgeInfo[33:67]
|
||||
node2Pub := edgeInfo[33:66]
|
||||
edge2, err := fetchChanEdgePolicy(edges, chanID, node2Pub, nodes)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user