sweep: add list sweeps function

This commit is contained in:
carla committed 2020-05-05 21:10:11 +02:00
1 parent 537dac3c62
commit 99a45e968a
4 files changed
+74 -2

No files matched your search

+24
View File
@@ -150,4 +150,28 @@ func testStore(t *testing.T, createStore func() (SweeperStore, error)) {
if ours {
t.Fatal("expected tx to be not ours")
}
txns, err := store.ListSweeps()
if err != nil {
t.Fatalf("unexpected error: %v", err)
}
// Create a map containing the sweeps we expect to be returned by list
// sweeps.
expected := map[chainhash.Hash]bool{
tx1.TxHash(): true,
tx2.TxHash(): true,
}
if len(txns) != len(expected) {
t.Fatalf("expected: %v sweeps, got: %v", len(expected),
len(txns))
}
for _, tx := range txns {
_, ok := expected[tx]
if !ok {
t.Fatalf("unexpected tx: %v", tx)
}
}
}