graph/db: let IsZombieEdge return an error
This commit is contained in:
5 files changed
+33
-16
No files matched your search
+14
-7
@@ -453,7 +453,8 @@ func TestEdgeInsertionDeletion(t *testing.T) {
|
||||
require.ErrorIs(t, err, ErrEdgeNotFound)
|
||||
_, _, _, err = graph.FetchChannelEdgesByID(chanID)
|
||||
require.ErrorIs(t, err, ErrZombieEdge)
|
||||
isZombie, _, _ := graph.IsZombieEdge(chanID)
|
||||
isZombie, _, _, err := graph.IsZombieEdge(chanID)
|
||||
require.NoError(t, err)
|
||||
require.True(t, isZombie)
|
||||
|
||||
// Finally, attempt to delete a (now) non-existent edge within the
|
||||
@@ -2205,7 +2206,9 @@ func TestFilterKnownChanIDsZombieRevival(t *testing.T) {
|
||||
)
|
||||
|
||||
isZombie := func(scid lnwire.ShortChannelID) bool {
|
||||
zombie, _, _ := graph.IsZombieEdge(scid.ToUint64())
|
||||
zombie, _, _, err := graph.IsZombieEdge(scid.ToUint64())
|
||||
require.NoError(t, err)
|
||||
|
||||
return zombie
|
||||
}
|
||||
|
||||
@@ -3844,15 +3847,17 @@ func TestGraphZombieIndex(t *testing.T) {
|
||||
|
||||
// Since the edge is known the graph and it isn't a zombie, IsZombieEdge
|
||||
// should not report the channel as a zombie.
|
||||
isZombie, _, _ := graph.IsZombieEdge(edge.ChannelID)
|
||||
isZombie, _, _, err := graph.IsZombieEdge(edge.ChannelID)
|
||||
require.NoError(t, err)
|
||||
require.False(t, isZombie)
|
||||
assertNumZombies(t, graph, 0)
|
||||
|
||||
// If we delete the edge and mark it as a zombie, then we should expect
|
||||
// to see it within the index.
|
||||
err := graph.DeleteChannelEdges(false, true, edge.ChannelID)
|
||||
err = graph.DeleteChannelEdges(false, true, edge.ChannelID)
|
||||
require.NoError(t, err, "unable to mark edge as zombie")
|
||||
isZombie, pubKey1, pubKey2 := graph.IsZombieEdge(edge.ChannelID)
|
||||
isZombie, pubKey1, pubKey2, err := graph.IsZombieEdge(edge.ChannelID)
|
||||
require.NoError(t, err)
|
||||
require.True(t, isZombie)
|
||||
require.Equal(t, node1.PubKeyBytes, pubKey1)
|
||||
require.Equal(t, node2.PubKeyBytes, pubKey2)
|
||||
@@ -3868,7 +3873,8 @@ func TestGraphZombieIndex(t *testing.T) {
|
||||
t, graph.MarkEdgeLive(edge.ChannelID), ErrZombieEdgeNotFound,
|
||||
)
|
||||
|
||||
isZombie, _, _ = graph.IsZombieEdge(edge.ChannelID)
|
||||
isZombie, _, _, err = graph.IsZombieEdge(edge.ChannelID)
|
||||
require.NoError(t, err)
|
||||
require.False(t, isZombie)
|
||||
|
||||
assertNumZombies(t, graph, 0)
|
||||
@@ -3880,7 +3886,8 @@ func TestGraphZombieIndex(t *testing.T) {
|
||||
)
|
||||
require.NoError(t, err, "unable to mark edge as zombie")
|
||||
|
||||
isZombie, _, _ = graph.IsZombieEdge(edge.ChannelID)
|
||||
isZombie, _, _, err = graph.IsZombieEdge(edge.ChannelID)
|
||||
require.NoError(t, err)
|
||||
require.True(t, isZombie)
|
||||
assertNumZombies(t, graph, 1)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user