mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 23:53:41 +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:
@@ -1227,7 +1227,7 @@ func TestHandleUnknownSpendTxOurs(t *testing.T) {
|
||||
txid := tx.TxHash()
|
||||
|
||||
// Mock the store to return true when calling IsOurTx.
|
||||
store.On("IsOurTx", txid).Return(true, nil).Once()
|
||||
store.On("IsOurTx", txid).Return(true).Once()
|
||||
|
||||
// Call the method under test.
|
||||
s.handleUnknownSpendTx(si, tx)
|
||||
@@ -1271,7 +1271,7 @@ func TestHandleInputSpendTxThirdParty(t *testing.T) {
|
||||
txid := tx.TxHash()
|
||||
|
||||
// Mock the store to return false when calling IsOurTx.
|
||||
store.On("IsOurTx", txid).Return(false, nil).Once()
|
||||
store.On("IsOurTx", txid).Return(false).Once()
|
||||
|
||||
// Mock `ListSweeps` to return an empty slice as we are testing the
|
||||
// workflow here, not the method `removeConflictSweepDescendants`.
|
||||
@@ -1333,7 +1333,7 @@ func TestHandleBumpEventTxUnknownSpendNoRetry(t *testing.T) {
|
||||
}
|
||||
|
||||
// Mock the store to return true when calling IsOurTx.
|
||||
store.On("IsOurTx", txid).Return(true, nil).Once()
|
||||
store.On("IsOurTx", txid).Return(true).Once()
|
||||
|
||||
// Call the method under test.
|
||||
s.handleBumpEventTxUnknownSpend(resp)
|
||||
@@ -1419,7 +1419,7 @@ func TestHandleBumpEventTxUnknownSpendWithRetry(t *testing.T) {
|
||||
}
|
||||
|
||||
// Mock the store to return true when calling IsOurTx.
|
||||
store.On("IsOurTx", txid).Return(true, nil).Once()
|
||||
store.On("IsOurTx", txid).Return(true).Once()
|
||||
|
||||
// Mock the aggregator to return an empty slice as we are not testing
|
||||
// the actual sweeping behavior.
|
||||
|
Reference in New Issue
Block a user