From 53dac7c65f33fae5c17589b6b8580a34fd3076e7 Mon Sep 17 00:00:00 2001 From: Chris Schinnerl Date: Fri, 15 Dec 2023 11:27:32 +0100 Subject: [PATCH] wallet: fix TestWalletRedistribute --- wallet/wallet.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wallet/wallet.go b/wallet/wallet.go index 76e8e60a9..aa14acb0f 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -366,7 +366,7 @@ func (w *SingleAddressWallet) Redistribute(cs consensus.State, outputs int, amou for outputs > 0 { var txn types.Transaction - for i := 0; outputs > 0 && i < redistributeBatchSize; i++ { + for i := 0; i < outputs && i < redistributeBatchSize; i++ { txn.SiacoinOutputs = append(txn.SiacoinOutputs, types.SiacoinOutput{ Value: amount, Address: w.Address(), @@ -434,6 +434,7 @@ func (w *SingleAddressWallet) Redistribute(cs consensus.State, outputs int, amou w.lastUsed[sce.ID] = time.Now() } + outputs -= len(txn.SiacoinOutputs) txns = append(txns, txn) }