Allow a fixed list of change addresses.
Conflicts: src/wallet.cpp
This commit is contained in:
parent
e9e06e8a03
commit
37fd22772f
|
@ -1397,6 +1397,20 @@ bool CWallet::CreateTransaction(const vector<pair<CScript, int64_t> >& vecSend,
|
||||||
// coin control: send change to custom address
|
// coin control: send change to custom address
|
||||||
if (coinControl && !boost::get<CNoDestination>(&coinControl->destChange))
|
if (coinControl && !boost::get<CNoDestination>(&coinControl->destChange))
|
||||||
scriptChange.SetDestination(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
|
// no coin control: send change to newly generated address
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue