multi: thread context through to AddrsForNode
This commit is contained in:
15 files changed
+88
-64
No files matched your search
@@ -183,7 +183,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
|
||||
|
||||
// Initially, the node is unknown to the graph and there should be no
|
||||
// addresses for it.
|
||||
known, addrs, err := graph.AddrsForNode(pub)
|
||||
known, addrs, err := graph.AddrsForNode(ctx, pub)
|
||||
require.NoError(t, err)
|
||||
require.False(t, known)
|
||||
require.Empty(t, addrs)
|
||||
@@ -197,7 +197,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Empty(t, dbNode.Addresses)
|
||||
|
||||
known, addrs, err = graph.AddrsForNode(pub)
|
||||
known, addrs, err = graph.AddrsForNode(ctx, pub)
|
||||
require.NoError(t, err)
|
||||
require.True(t, known)
|
||||
require.Empty(t, addrs)
|
||||
@@ -224,7 +224,7 @@ func TestNodeInsertionAndDeletion(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, expAddrs, dbNode.Addresses)
|
||||
|
||||
known, addrs, err = graph.AddrsForNode(pub)
|
||||
known, addrs, err = graph.AddrsForNode(ctx, pub)
|
||||
require.NoError(t, err)
|
||||
require.True(t, known)
|
||||
require.EqualValues(t, expAddrs, addrs)
|
||||
|
||||
@@ -63,7 +63,8 @@ type V1Store interface { //nolint:interfacebloat
|
||||
// AddrsForNode returns all known addresses for the target node public
|
||||
// key that the graph DB is aware of. The returned boolean indicates if
|
||||
// the given node is unknown to the graph DB or not.
|
||||
AddrsForNode(nodePub *btcec.PublicKey) (bool, []net.Addr, error)
|
||||
AddrsForNode(ctx context.Context,
|
||||
nodePub *btcec.PublicKey) (bool, []net.Addr, error)
|
||||
|
||||
// ForEachSourceNodeChannel iterates through all channels of the source
|
||||
// node, executing the passed callback on each. The call-back is
|
||||
|
||||
@@ -376,10 +376,8 @@ func initKVStore(db kvdb.Backend) error {
|
||||
// unknown to the graph DB or not.
|
||||
//
|
||||
// NOTE: this is part of the channeldb.AddrSource interface.
|
||||
func (c *KVStore) AddrsForNode(nodePub *btcec.PublicKey) (bool, []net.Addr,
|
||||
error) {
|
||||
|
||||
ctx := context.TODO()
|
||||
func (c *KVStore) AddrsForNode(ctx context.Context,
|
||||
nodePub *btcec.PublicKey) (bool, []net.Addr, error) {
|
||||
|
||||
pubKey, err := route.NewVertexFromBytes(nodePub.SerializeCompressed())
|
||||
if err != nil {
|
||||
|
||||
@@ -258,10 +258,8 @@ func (s *SQLStore) HasLightningNode(ctx context.Context,
|
||||
// given node is unknown to the graph DB or not.
|
||||
//
|
||||
// NOTE: part of the V1Store interface.
|
||||
func (s *SQLStore) AddrsForNode(nodePub *btcec.PublicKey) (bool, []net.Addr,
|
||||
error) {
|
||||
|
||||
ctx := context.TODO()
|
||||
func (s *SQLStore) AddrsForNode(ctx context.Context,
|
||||
nodePub *btcec.PublicKey) (bool, []net.Addr, error) {
|
||||
|
||||
var (
|
||||
addresses []net.Addr
|
||||
|
||||
Reference in new issue
Block a user