diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6070b9583b..f423eb734c 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -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; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6d1118c59b..711e5a17f5 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2687,6 +2687,13 @@ bool CWallet::FundTransaction(CMutableTransaction& tx, CAmount& nFeeRet, bool ov bool CWallet::CreateTransaction(const vector& vecSend, CWalletTx& wtxNew, std::vector& vpChangeKey, CAmount& nFeeRet, int& nChangePosInOut, std::string& strFailReason, const CCoinControl* coinControl, bool sign, std::vector *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& vecSend, CWalletTx& wt if (pubkey != CPubKey()) { numToBlind++; } + // reset nChangePosInOut for next asset + nChangePosInOut = -1; } } else