Fix just asking Wallet.doMaintenance() for if maintenance needs to be done wastes addresses.

This commit is contained in:
Andreas Schildbach 2014-11-14 17:19:19 +01:00
parent 533489ed78
commit cdc1a4ce99

View file

@ -4522,7 +4522,8 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
for (TransactionOutput output : toMove.gathered) {
rekeyTx.addInput(output);
}
rekeyTx.addOutput(toMove.valueGathered, freshReceiveAddress());
// When not signing, don't waste addresses.
rekeyTx.addOutput(toMove.valueGathered, sign ? freshReceiveAddress() : currentReceiveAddress());
if (!adjustOutputDownwardsForFee(rekeyTx, toMove, Coin.ZERO, Transaction.REFERENCE_DEFAULT_MIN_TX_FEE)) {
log.error("Failed to adjust rekey tx for fees.");
return null;