graph/db: thread context through to FetchLightingNode
This commit is contained in:
12 files changed
+47
-39
No files matched your search
@@ -4637,6 +4637,8 @@ func (s *server) peerInitializer(p *peer.Brontide) {
|
||||
func (s *server) peerTerminationWatcher(p *peer.Brontide, ready chan struct{}) {
|
||||
defer s.wg.Done()
|
||||
|
||||
ctx := context.TODO()
|
||||
|
||||
p.WaitForDisconnect(ready)
|
||||
|
||||
srvrLog.Debugf("Peer %v has been disconnected", p)
|
||||
@@ -4723,7 +4725,7 @@ func (s *server) peerTerminationWatcher(p *peer.Brontide, ready chan struct{}) {
|
||||
|
||||
// We'll ensure that we locate all the peers advertised addresses for
|
||||
// reconnection purposes.
|
||||
advertisedAddrs, err := s.fetchNodeAdvertisedAddrs(pubKey)
|
||||
advertisedAddrs, err := s.fetchNodeAdvertisedAddrs(ctx, pubKey)
|
||||
switch {
|
||||
// We found advertised addresses, so use them.
|
||||
case err == nil:
|
||||
@@ -5216,13 +5218,15 @@ func computeNextBackoff(currBackoff, maxBackoff time.Duration) time.Duration {
|
||||
var errNoAdvertisedAddr = errors.New("no advertised address found")
|
||||
|
||||
// fetchNodeAdvertisedAddrs attempts to fetch the advertised addresses of a node.
|
||||
func (s *server) fetchNodeAdvertisedAddrs(pub *btcec.PublicKey) ([]net.Addr, error) {
|
||||
func (s *server) fetchNodeAdvertisedAddrs(ctx context.Context,
|
||||
pub *btcec.PublicKey) ([]net.Addr, error) {
|
||||
|
||||
vertex, err := route.NewVertexFromBytes(pub.SerializeCompressed())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
node, err := s.graphDB.FetchLightningNode(vertex)
|
||||
node, err := s.graphDB.FetchLightningNode(ctx, vertex)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user