autopilot: start threading contexts through
The `GraphSource` interface in the `autopilot` package is directly implemented by the `graphdb.KVStore` and so we will eventually thread contexts through to this interface. So in this commit, we start updating the autopilot system to thread contexts through in preparation for passing the context through to any calls made to the GraphSource. Two context.TODOs are added here which will be addressed in follow up commits.
This commit is contained in:
13 files changed
+146
-71
No files matched your search
@@ -161,6 +161,8 @@ func (c *ChannelGraphBootstrapper) SampleNodeAddrs(_ context.Context,
|
||||
numAddrs uint32,
|
||||
ignore map[autopilot.NodeID]struct{}) ([]*lnwire.NetAddress, error) {
|
||||
|
||||
ctx := context.TODO()
|
||||
|
||||
// We'll merge the ignore map with our currently selected map in order
|
||||
// to ensure we don't return any duplicate nodes.
|
||||
for n := range ignore {
|
||||
@@ -183,7 +185,9 @@ func (c *ChannelGraphBootstrapper) SampleNodeAddrs(_ context.Context,
|
||||
errFound = fmt.Errorf("found node")
|
||||
)
|
||||
|
||||
err := c.chanGraph.ForEachNode(func(node autopilot.Node) error {
|
||||
err := c.chanGraph.ForEachNode(ctx, func(_ context.Context,
|
||||
node autopilot.Node) error {
|
||||
|
||||
nID := autopilot.NodeID(node.PubKey())
|
||||
if _, ok := c.tried[nID]; ok {
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user