mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-12-08 20:03:10 +01:00
sweeper_test: return unique wallet utxos
We also increase the value of the wallet UTXO, as it is needed when we want to afford fees for larger transactions.
This commit is contained in:
@@ -27,6 +27,7 @@ type mockBackend struct {
|
||||
publishChan chan wire.MsgTx
|
||||
|
||||
walletUtxos []*lnwallet.Utxo
|
||||
utxoCnt int
|
||||
}
|
||||
|
||||
func newMockBackend(t *testing.T, notifier *MockNotifier) *mockBackend {
|
||||
@@ -88,6 +89,16 @@ func (b *mockBackend) PublishTransaction(tx *wire.MsgTx, _ string) error {
|
||||
|
||||
func (b *mockBackend) ListUnspentWitness(minconfirms, maxconfirms int32) (
|
||||
[]*lnwallet.Utxo, error) {
|
||||
b.lock.Lock()
|
||||
defer b.lock.Unlock()
|
||||
|
||||
// Each time we list output, we increment the utxo counter, to
|
||||
// ensure we don't return the same outpoint every time.
|
||||
b.utxoCnt++
|
||||
|
||||
for i := range b.walletUtxos {
|
||||
b.walletUtxos[i].OutPoint.Hash[0] = byte(b.utxoCnt)
|
||||
}
|
||||
|
||||
return b.walletUtxos, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user