Disable changePosition arguments functionality, only used in fundraw

This commit is contained in:
Gregory Sanders 2017-04-17 15:45:13 -04:00
parent da87a78f98
commit 0d7c6d4f7f
2 changed files with 12 additions and 4 deletions

View file

@ -2868,7 +2868,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
"2. options (object, optional)\n"
" {\n"
" \"changeAddress\" (string, optional, default pool address) The bitcoin address to receive the change\n"
" \"changePosition\" (numeric, optional, default random) The index of the change output\n"
" \"changePosition\" (numeric, optional, default random) The index of the change output (DISABLED)\n"
" \"includeWatching\" (boolean, optional, default false) Also select inputs which are watch only\n"
" \"lockUnspents\" (boolean, optional, default false) Lock selected unspent outputs\n"
" \"reserveChangeKey\" (boolean, optional, default true) Reserves the change output key from the keypool\n"
@ -2885,7 +2885,6 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
"{\n"
" \"hex\": \"value\", (string) The resulting raw transaction (hex-encoded string)\n"
" \"fee\": n, (numeric) Fee in " + CURRENCY_UNIT + " the resulting transaction pays\n"
" \"changepos\": n (numeric) The position of the added change output, or -1\n"
"}\n"
"\nExamples:\n"
"\nCreate a transaction with no inputs\n"
@ -2942,7 +2941,8 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
}
if (options.exists("changePosition"))
changePosition = options["changePosition"].get_int();
throw JSONRPCError(RPC_INVALID_PARAMETER, "changePosition argument is disabled");
//changePosition = options["changePosition"].get_int();
if (options.exists("includeWatching"))
includeWatching = options["includeWatching"].get_bool();
@ -2994,7 +2994,6 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
UniValue result(UniValue::VOBJ);
result.push_back(Pair("hex", EncodeHexTx(tx)));
result.push_back(Pair("changepos", changePosition));
result.push_back(Pair("fee", ValueFromAmount(nFeeOut)));
return result;

View file

@ -2687,6 +2687,13 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, bool ov
bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wtxNew, std::vector<CReserveKey*>& vpChangeKey, CAmount& nFeeRet,
int& nChangePosInOut, std::string& strFailReason, const CCoinControl* coinControl, bool sign, std::vector<CAmount> *outAmounts, bool fBlindIssuances, const uint256* issuanceEntropy, const CAsset* reissuanceAsset, const CAsset* reissuanceToken)
{
// TODO re-enable to support multiple assets in a logical fashion, since the number of possible
// change positions are number of assets being spent.
if (nChangePosInOut != -1) {
strFailReason = _("change position argument has been disabled");
return false;
}
CAmountMap mapValue;
int nChangePosRequest = nChangePosInOut;
unsigned int nSubtractFeeFromAmount = 0;
@ -2926,6 +2933,8 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
if (pubkey != CPubKey()) {
numToBlind++;
}
// reset nChangePosInOut for next asset
nChangePosInOut = -1;
}
}
else