diff options
| author | Chris Moore <[email protected]> | 2014-02-01 08:06:22 -0800 |
|---|---|---|
| committer | Ross Nicoll <[email protected]> | 2014-04-05 23:38:38 +0100 |
| commit | 37fd22772f3fcc9b606782ac1083551bdd184e40 (patch) | |
| tree | fe7d1592325008aed12f86e79320e298335e285a /src/wallet.cpp | |
| parent | Merge pull request #411 from jwiechers/patch-3 (diff) | |
| download | discoin-37fd22772f3fcc9b606782ac1083551bdd184e40.tar.xz discoin-37fd22772f3fcc9b606782ac1083551bdd184e40.zip | |
Allow a fixed list of change addresses.
Conflicts:
src/wallet.cpp
Diffstat (limited to 'src/wallet.cpp')
| -rw-r--r-- | src/wallet.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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<pair<CScript, int64_t> >& vecSend, // coin control: send change to custom address 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 |