graph/db: gracefully handle duplicate channel policy announcements

This commit is contained in:
Elle Mouton committed 2025-10-06 11:37:39 +02:00
1 parent abb9654856
commit eb67757a07
2 files changed
+16 -1

No files matched your search

+7
View File
@@ -944,6 +944,13 @@ func TestEdgePolicyCRUD(t *testing.T) {
require.NoError(t, graph.UpdateEdgePolicy(ctx, edge1))
require.NoError(t, graph.UpdateEdgePolicy(ctx, edge2))
// Even though we assert at the DB level that any newer edge
// update has a newer timestamp, we need to still gracefully
// handle the case where the same exact policy is re-added since
// it could be possible that our batch executor has two of the
// same policy updates in the same batch.
require.NoError(t, graph.UpdateEdgePolicy(ctx, edge1))
// Use the ForEachChannel method to fetch the policies and
// assert that the deserialized policies match the original
// ones.