From 37fd22772f3fcc9b606782ac1083551bdd184e40 Mon Sep 17 00:00:00 2001 From: Chris Moore Date: Sat, 1 Feb 2014 08:06:22 -0800 Subject: [PATCH] Allow a fixed list of change addresses. Conflicts: src/wallet.cpp --- src/wallet.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/wallet.cpp b/src/wallet.cpp index fb9c61f7c..bd9d901cc 100644 --- a/src/wallet.cpp +++ b/src/wallet.cpp @@ -1397,6 +1397,20 @@ bool CWallet::CreateTransaction(const vector >& vecSend, // coin control: send change to custom address if (coinControl && !boost::get(&coinControl->destChange)) scriptChange.SetDestination(coinControl->destChange); + + // send change to one of the specified change addresses + else if (mapArgs.count("-change") && mapMultiArgs["-change"].size() > 0) + { + CBitcoinAddress address(mapMultiArgs["-change"][GetRandInt(mapMultiArgs["-change"].size())]); + + CKeyID keyID; + if (!address.GetKeyID(keyID)) { + strFailReason = _("Bad change address"); + return false; + } + + scriptChange.SetDestination(keyID); + } // no coin control: send change to newly generated address else