mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-03 19:34:23 +02:00
sweep: refactor IsOurTx
to not return an error
Before this commit, the only error returned from `IsOurTx` is when the root bucket was not created. In that case, we should consider the tx to be not found in our db, since technically our db is empty. A future PR may consider treating our wallet as the single source of truth and query the wallet instead to check for past sweeping txns.
This commit is contained in:
@@ -57,18 +57,15 @@ func TestStore(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// Assert that both txes are recognized as our own.
|
||||
ours, err := store.IsOurTx(tx1.TxHash())
|
||||
require.NoError(t, err)
|
||||
ours := store.IsOurTx(tx1.TxHash())
|
||||
require.True(t, ours, "expected tx to be ours")
|
||||
|
||||
ours, err = store.IsOurTx(tx2.TxHash())
|
||||
require.NoError(t, err)
|
||||
ours = store.IsOurTx(tx2.TxHash())
|
||||
require.True(t, ours, "expected tx to be ours")
|
||||
|
||||
// An different hash should be reported as not being ours.
|
||||
var unknownHash chainhash.Hash
|
||||
ours, err = store.IsOurTx(unknownHash)
|
||||
require.NoError(t, err)
|
||||
ours = store.IsOurTx(unknownHash)
|
||||
require.False(t, ours, "expected tx to not be ours")
|
||||
|
||||
txns, err := store.ListSweeps()
|
||||
|
Reference in New Issue
Block a user