graph/db: thread context through NumZombies
This commit is contained in:
6 files changed
+7
-8
No files matched your search
+2
-2
@@ -761,8 +761,8 @@ func (c *ChannelGraph) IsZombieEdge(ctx context.Context,
|
||||
}
|
||||
|
||||
// NumZombies returns the current number of zombie channels in the graph.
|
||||
func (c *ChannelGraph) NumZombies() (uint64, error) {
|
||||
return c.db.NumZombies()
|
||||
func (c *ChannelGraph) NumZombies(ctx context.Context) (uint64, error) {
|
||||
return c.db.NumZombies(ctx)
|
||||
}
|
||||
|
||||
// PutClosedScid stores a SCID for a closed channel in the database.
|
||||
|
||||
@@ -4535,7 +4535,7 @@ func putSerializedPolicy(t *testing.T, db kvdb.Backend, from []byte,
|
||||
func assertNumZombies(t *testing.T, graph *ChannelGraph, expZombies uint64) {
|
||||
t.Helper()
|
||||
|
||||
numZombies, err := graph.NumZombies()
|
||||
numZombies, err := graph.NumZombies(t.Context())
|
||||
require.NoError(t, err, "unable to query number of zombies")
|
||||
require.Equal(t, expZombies, numZombies)
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ type Store interface { //nolint:interfacebloat
|
||||
|
||||
// NumZombies returns the current number of zombie channels in the
|
||||
// graph.
|
||||
NumZombies() (uint64, error)
|
||||
NumZombies(ctx context.Context) (uint64, error)
|
||||
|
||||
// PutClosedScid stores a SCID for a closed channel in the database.
|
||||
// This is so that we can ignore channel announcements that we know to
|
||||
|
||||
@@ -4405,7 +4405,7 @@ func isZombieEdge(zombieIndex kvdb.RBucket,
|
||||
}
|
||||
|
||||
// NumZombies returns the current number of zombie channels in the graph.
|
||||
func (c *KVStore) NumZombies() (uint64, error) {
|
||||
func (c *KVStore) NumZombies(_ context.Context) (uint64, error) {
|
||||
var numZombies uint64
|
||||
err := kvdb.View(c.db, func(tx kvdb.RTx) error {
|
||||
edges := tx.ReadBucket(edgeBucket)
|
||||
|
||||
@@ -1912,9 +1912,8 @@ func (s *SQLStore) IsZombieEdge(ctx context.Context, v lnwire.GossipVersion,
|
||||
// NumZombies returns the current number of zombie channels in the graph.
|
||||
//
|
||||
// NOTE: part of the Store interface.
|
||||
func (s *SQLStore) NumZombies() (uint64, error) {
|
||||
func (s *SQLStore) NumZombies(ctx context.Context) (uint64, error) {
|
||||
var (
|
||||
ctx = context.TODO()
|
||||
numZombies uint64
|
||||
)
|
||||
err := s.db.ExecTx(ctx, sqldb.ReadTxOpt(), func(db SQLQueries) error {
|
||||
|
||||
+1
-1
@@ -7376,7 +7376,7 @@ func (r *rpcServer) GetNetworkInfo(ctx context.Context,
|
||||
}
|
||||
|
||||
// Query the graph for the current number of zombie channels.
|
||||
numZombies, err := graph.NumZombies()
|
||||
numZombies, err := graph.NumZombies(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user