aboutsummaryrefslogtreecommitdiff
path: root/src/wallet.cpp
diff options
context:
space:
mode:
authorChris Moore <[email protected]>2014-02-01 08:06:22 -0800
committerChris Moore <[email protected]>2014-02-01 08:06:22 -0800
commitbfc0df86735f26a69192b7bb06ed881ab61e54c1 (patch)
tree0f40d82682efec3d452a295ddcf8a4da78d8bb42 /src/wallet.cpp
parentToolbar icon fix for Windows (system tray) (diff)
downloaddiscoin-bfc0df86735f26a69192b7bb06ed881ab61e54c1.tar.xz
discoin-bfc0df86735f26a69192b7bb06ed881ab61e54c1.zip
Allow a fixed list of change addresses.
Diffstat (limited to 'src/wallet.cpp')
-rw-r--r--src/wallet.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/wallet.cpp b/src/wallet.cpp
index cd3e5af4c..604068ee7 100644
--- a/src/wallet.cpp
+++ b/src/wallet.cpp
@@ -1248,6 +1248,19 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64> >& vecSend,
if (coinControl && !boost::get<CNoDestination>(&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
{