chainntnfs+sweep: add LookupInputMempoolSpend and use it in the
sweeper This commit implements a new method, `LookupInputMempoolSpend` to do lookups in the mempool. This method is useful in the case when we only want to know whether an input is already been spent in the mempool by the time we call.
This commit is contained in:
6 files changed
+107
-111
No files matched your search
@@ -2,6 +2,7 @@ package chainntnfs
|
||||
|
||||
import (
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/fn"
|
||||
"github.com/stretchr/testify/mock"
|
||||
)
|
||||
|
||||
@@ -39,3 +40,13 @@ func (m *MockMempoolWatcher) CancelMempoolSpendEvent(
|
||||
|
||||
m.Called(sub)
|
||||
}
|
||||
|
||||
// LookupInputMempoolSpend looks up the mempool to find a spending tx which
|
||||
// spends the given outpoint.
|
||||
func (m *MockMempoolWatcher) LookupInputMempoolSpend(
|
||||
op wire.OutPoint) fn.Option[wire.MsgTx] {
|
||||
|
||||
args := m.Called(op)
|
||||
|
||||
return args.Get(0).(fn.Option[wire.MsgTx])
|
||||
}
|
||||
Reference in new issue
Block a user