autopilot: fix nil map assignment

Use the `clear` call to reset a map on `reset` instead of assigning nil
to the entry.
This commit is contained in:
Elle Mouton committed 2025-09-18 07:37:53 +02:00
1 parent 1ee3b95f6d
commit a5cf958c2c
3 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -644,8 +644,8 @@ func (a *Agent) openChans(ctx context.Context, availableFunds btcutil.Amount,
nodes[nID] = struct{}{}
return nil
}, func() {
nodes = nil
addresses = nil
clear(nodes)
clear(addresses)
}); err != nil {
return fmt.Errorf("unable to get graph nodes: %w", err)
}
+1 -1
View File
@@ -249,7 +249,7 @@ func (c *ChannelGraphBootstrapper) SampleNodeAddrs(_ context.Context,
return errFound
}, func() {
a = nil
clear(a)
})
if err != nil && !errors.Is(err, errFound) {
return nil, err
+1 -1
View File
@@ -7284,7 +7284,7 @@ func (r *rpcServer) GetNetworkInfo(ctx context.Context,
totalNetworkCapacity = 0
minChannelSize = math.MaxInt64
maxChannelSize = 0
allChans = nil
clear(allChans)
clear(seenChans)
})
if err != nil {