diff --git a/src/masternodes/mn_rpc.cpp b/src/masternodes/mn_rpc.cpp index 52ebe59e81..5ccd5e01c2 100644 --- a/src/masternodes/mn_rpc.cpp +++ b/src/masternodes/mn_rpc.cpp @@ -316,7 +316,11 @@ static std::optional GetAuthInputOnly(CWalletCoinsUnlocker& pwallet, CTxD return txin; } -static CTransactionRef CreateAuthTx(CWalletCoinsUnlocker& pwallet, std::set const & auths, int32_t txVersion) { +static CTransactionRef CreateAuthTx(CWalletCoinsUnlocker& pwallet, + std::set const & auths, + int32_t txVersion, + const CoinSelectionOptions &coinSelectOpts) { + CMutableTransaction mtx(txVersion); CCoinControl coinControl; @@ -337,7 +341,7 @@ static CTransactionRef CreateAuthTx(CWalletCoinsUnlocker& pwallet, std::set GetAnyFoundationAuthInput(CWalletCoinsUnlocker& pwallet) { @@ -428,7 +432,7 @@ std::vector GetAuthInputsSmart(CWalletCoinsUnlocker& pwallet, int32_t txV // at last, create additional tx for missed if (!notFoundYet.empty()) { try { - optAuthTx = CreateAuthTx(pwallet, notFoundYet, txVersion); // success or throw + optAuthTx = CreateAuthTx(pwallet, notFoundYet, txVersion, coinSelectOpts); // success or throw } catch (const UniValue& objError) { throw JSONRPCError(objError["code"].get_int(), "Add-on auth TX failed: " + objError["message"].getValStr()); } @@ -593,7 +597,7 @@ UniValue setgov(const JSONRPCRequest& request) { UniValue const & txInputs = request.params[1]; CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -606,7 +610,7 @@ UniValue setgov(const JSONRPCRequest& request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -685,7 +689,7 @@ UniValue unsetgov(const JSONRPCRequest& request) { UniValue const & txInputs = request.params[1]; CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -698,7 +702,7 @@ UniValue unsetgov(const JSONRPCRequest& request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -807,7 +811,7 @@ UniValue setgovheight(const JSONRPCRequest& request) { UniValue const & txInputs = request.params[2]; CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -820,7 +824,7 @@ UniValue setgovheight(const JSONRPCRequest& request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); diff --git a/src/masternodes/rpc_accounts.cpp b/src/masternodes/rpc_accounts.cpp index 538a14e2e4..068e899821 100644 --- a/src/masternodes/rpc_accounts.cpp +++ b/src/masternodes/rpc_accounts.cpp @@ -663,7 +663,7 @@ UniValue utxostoaccount(const JSONRPCRequest& request) { } // fund - fund(rawTx, pwallet, {}); + fund(rawTx, pwallet, {}, nullptr, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight); @@ -806,7 +806,7 @@ UniValue accounttoaccount(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{msg.from}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -818,7 +818,7 @@ UniValue accounttoaccount(const JSONRPCRequest& request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -911,7 +911,7 @@ UniValue accounttoutxos(const JSONRPCRequest& request) { const UniValue &txInputs = request.params[2]; CTransactionRef optAuthTx; std::set auths{msg.from}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -923,7 +923,7 @@ UniValue accounttoutxos(const JSONRPCRequest& request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // re-encode with filled mintingOutputsStart { @@ -1909,7 +1909,7 @@ UniValue sendtokenstoaddress(const JSONRPCRequest& request) { auths.emplace(acc.first); } CTransactionRef optAuthTx; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -1923,7 +1923,7 @@ UniValue sendtokenstoaddress(const JSONRPCRequest& request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -2192,7 +2192,7 @@ UniValue HandleSendDFIP2201DFIInput(const JSONRPCRequest& request, CWalletCoinsU coinControl.matchDestination = dest; // fund - fund(rawTx, pwallet, {}, &coinControl); + fund(rawTx, pwallet, {}, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight); @@ -2230,14 +2230,14 @@ UniValue HandleSendDFIP2201BTCInput(const JSONRPCRequest& request, CWalletCoinsU CTransactionRef optAuthTx; std::set auth{script}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auth, false, optAuthTx, request.params[3]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auth, false, optAuthTx, request.params[3], request.metadata.coinSelectOpts); // Set change address CCoinControl coinControl; coinControl.destChange = dest; // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -2379,14 +2379,14 @@ UniValue futureswap(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auth{msg.owner}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auth, false, optAuthTx, request.params[3]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auth, false, optAuthTx, request.params[3], request.metadata.coinSelectOpts); // Set change address CCoinControl coinControl; coinControl.destChange = dest; // Fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // Check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -2470,14 +2470,14 @@ UniValue withdrawfutureswap(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auth{msg.owner}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auth, false, optAuthTx, request.params[3]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auth, false, optAuthTx, request.params[3], request.metadata.coinSelectOpts); // Set change address CCoinControl coinControl; coinControl.destChange = dest; // Fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // Check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); diff --git a/src/masternodes/rpc_icxorderbook.cpp b/src/masternodes/rpc_icxorderbook.cpp index d48f4bddbd..a9c677a8dc 100644 --- a/src/masternodes/rpc_icxorderbook.cpp +++ b/src/masternodes/rpc_icxorderbook.cpp @@ -323,7 +323,7 @@ UniValue icxcreateorder(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{order.ownerAddress}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -335,7 +335,7 @@ UniValue icxcreateorder(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -465,7 +465,7 @@ UniValue icxmakeoffer(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{makeoffer.ownerAddress}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -477,7 +477,7 @@ UniValue icxmakeoffer(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx,&coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -607,7 +607,7 @@ UniValue icxsubmitdfchtlc(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{authScript}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -619,7 +619,7 @@ UniValue icxsubmitdfchtlc(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -753,7 +753,7 @@ UniValue icxsubmitexthtlc(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{authScript}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -767,7 +767,7 @@ UniValue icxsubmitexthtlc(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx,&coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -857,7 +857,7 @@ UniValue icxclaimdfchtlc(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -869,7 +869,7 @@ UniValue icxclaimdfchtlc(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -953,7 +953,7 @@ UniValue icxcloseorder(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{authScript}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -965,7 +965,7 @@ UniValue icxcloseorder(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx,&coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -1050,7 +1050,7 @@ UniValue icxcloseoffer(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{authScript}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -1062,7 +1062,7 @@ UniValue icxcloseoffer(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx,&coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); diff --git a/src/masternodes/rpc_loan.cpp b/src/masternodes/rpc_loan.cpp index f024f3e414..1f03e1e939 100644 --- a/src/masternodes/rpc_loan.cpp +++ b/src/masternodes/rpc_loan.cpp @@ -155,7 +155,7 @@ UniValue setcollateraltoken(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -167,7 +167,7 @@ UniValue setcollateraltoken(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -360,7 +360,7 @@ UniValue setloantoken(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -372,7 +372,7 @@ UniValue setloantoken(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -481,7 +481,7 @@ UniValue updateloantoken(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(0, scriptMeta)); @@ -493,7 +493,7 @@ UniValue updateloantoken(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -648,7 +648,7 @@ UniValue createloanscheme(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, request.params[3]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, request.params[3], request.metadata.coinSelectOpts); rawTx.vout.emplace_back(0, scriptMeta); @@ -661,7 +661,7 @@ UniValue createloanscheme(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -735,7 +735,7 @@ UniValue updateloanscheme(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, request.params[4]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, request.params[4], request.metadata.coinSelectOpts); rawTx.vout.emplace_back(0, scriptMeta); @@ -748,7 +748,7 @@ UniValue updateloanscheme(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -811,7 +811,7 @@ UniValue setdefaultloanscheme(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, request.params[1]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, request.params[1], request.metadata.coinSelectOpts); rawTx.vout.emplace_back(0, scriptMeta); @@ -823,7 +823,7 @@ UniValue setdefaultloanscheme(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -890,7 +890,7 @@ UniValue destroyloanscheme(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, request.params[2]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, request.params[2], request.metadata.coinSelectOpts); rawTx.vout.emplace_back(0, scriptMeta); @@ -902,7 +902,7 @@ UniValue destroyloanscheme(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -1103,7 +1103,7 @@ UniValue takeloan(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{ownerAddress}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.emplace_back(0, scriptMeta); @@ -1115,7 +1115,7 @@ UniValue takeloan(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -1287,7 +1287,7 @@ UniValue paybackloan(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{from}; const UniValue &txInputs = request.params[1]; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.emplace_back(0, scriptMeta); @@ -1299,7 +1299,7 @@ UniValue paybackloan(const JSONRPCRequest& request) { if (IsValidDestination(dest)) coinControl.destChange = dest; - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -1604,7 +1604,7 @@ UniValue paybackwithcollateral(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{ownerAddress}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -1615,7 +1615,7 @@ UniValue paybackwithcollateral(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); diff --git a/src/masternodes/rpc_masternodes.cpp b/src/masternodes/rpc_masternodes.cpp index 39e22d47ca..40a0635ae5 100644 --- a/src/masternodes/rpc_masternodes.cpp +++ b/src/masternodes/rpc_masternodes.cpp @@ -186,7 +186,7 @@ UniValue createmasternode(const JSONRPCRequest& request) CTransactionRef optAuthTx; auto scriptOwner = GetScriptForDestination(ownerDest); std::set auths{scriptOwner}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[2]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[2], request.metadata.coinSelectOpts); // Return change to owner address CCoinControl coinControl; @@ -197,7 +197,7 @@ UniValue createmasternode(const JSONRPCRequest& request) rawTx.vout.push_back(CTxOut(EstimateMnCreationFee(targetHeight), scriptMeta)); rawTx.vout.push_back(CTxOut(GetMnCollateralAmount(targetHeight), scriptOwner)); - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -277,7 +277,7 @@ UniValue resignmasternode(const JSONRPCRequest& request) if (collateralDest.index() != 0) { auths.insert(GetScriptForDestination(collateralDest)); } - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[1]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[1], request.metadata.coinSelectOpts); // Return change to owner address CCoinControl coinControl; @@ -294,7 +294,7 @@ UniValue resignmasternode(const JSONRPCRequest& request) rawTx.vout.push_back(CTxOut(0, scriptMeta)); - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -395,7 +395,7 @@ UniValue updatemasternode(const JSONRPCRequest& request) CTransactionRef optAuthTx; std::set auths{GetScriptForDestination(ownerDest)}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[2]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[2], request.metadata.coinSelectOpts); // Return change to owner address CCoinControl coinControl; @@ -442,7 +442,7 @@ UniValue updatemasternode(const JSONRPCRequest& request) } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); diff --git a/src/masternodes/rpc_oracles.cpp b/src/masternodes/rpc_oracles.cpp index 9a3defc9f1..125c7f90dd 100644 --- a/src/masternodes/rpc_oracles.cpp +++ b/src/masternodes/rpc_oracles.cpp @@ -152,7 +152,7 @@ UniValue appointoracle(const JSONRPCRequest &request) { UniValue const &txInputs = request.params[3]; CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -165,7 +165,7 @@ UniValue appointoracle(const JSONRPCRequest &request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -267,7 +267,7 @@ UniValue updateoracle(const JSONRPCRequest& request) { UniValue const &txInputs = request.params[4]; CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl;// std::string oracles; @@ -280,7 +280,7 @@ UniValue updateoracle(const JSONRPCRequest& request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -347,7 +347,7 @@ UniValue removeoracle(const JSONRPCRequest& request) { UniValue const &txInputs = request.params[1]; CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -361,7 +361,7 @@ UniValue removeoracle(const JSONRPCRequest& request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -509,7 +509,7 @@ UniValue setoracledata(const JSONRPCRequest &request) { std::set auths{oracleAddress}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -522,7 +522,7 @@ UniValue setoracledata(const JSONRPCRequest &request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); diff --git a/src/masternodes/rpc_poolpair.cpp b/src/masternodes/rpc_poolpair.cpp index 5b735f6f88..43540c1353 100644 --- a/src/masternodes/rpc_poolpair.cpp +++ b/src/masternodes/rpc_poolpair.cpp @@ -423,7 +423,7 @@ UniValue addpoolliquidity(const JSONRPCRequest &request) { } const UniValue &txInputs = request.params[2]; CTransactionRef optAuthTx; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -437,7 +437,7 @@ UniValue addpoolliquidity(const JSONRPCRequest &request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -511,7 +511,7 @@ UniValue removepoolliquidity(const JSONRPCRequest &request) { CTransactionRef optAuthTx; std::set auths{msg.from}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -523,7 +523,7 @@ UniValue removepoolliquidity(const JSONRPCRequest &request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -687,7 +687,7 @@ UniValue createpoolpair(const JSONRPCRequest &request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -699,7 +699,7 @@ UniValue createpoolpair(const JSONRPCRequest &request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -821,7 +821,7 @@ UniValue updatepoolpair(const JSONRPCRequest &request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); CDataStream metadata(DfTxMarker, SER_NETWORK, PROTOCOL_VERSION); metadata << static_cast(CustomTxType::UpdatePoolPair) @@ -846,7 +846,7 @@ UniValue updatepoolpair(const JSONRPCRequest &request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -946,7 +946,7 @@ UniValue poolswap(const JSONRPCRequest &request) { const UniValue &txInputs = request.params[1]; CTransactionRef optAuthTx; std::set auths{poolSwapMsg.from}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -958,7 +958,7 @@ UniValue poolswap(const JSONRPCRequest &request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -1089,7 +1089,7 @@ UniValue compositeswap(const JSONRPCRequest &request) { const UniValue &txInputs = request.params[1]; CTransactionRef optAuthTx; std::set auths{poolSwapMsg.from}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -1101,7 +1101,7 @@ UniValue compositeswap(const JSONRPCRequest &request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); diff --git a/src/masternodes/rpc_proposals.cpp b/src/masternodes/rpc_proposals.cpp index be376e650a..dce091328b 100644 --- a/src/masternodes/rpc_proposals.cpp +++ b/src/masternodes/rpc_proposals.cpp @@ -282,7 +282,7 @@ UniValue creategovcfp(const JSONRPCRequest &request) { CTransactionRef optAuthTx; std::set auths{pm.address}; rawTx.vin = - GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, request.params[1]); + GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[1], request.metadata.coinSelectOpts); auto cfpFee = GetProposalCreationFee(targetHeight, *pcustomcsview, pm); rawTx.vout.emplace_back(CTxOut(cfpFee, scriptMeta)); @@ -297,7 +297,7 @@ UniValue creategovcfp(const JSONRPCRequest &request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -419,7 +419,7 @@ UniValue creategovvoc(const JSONRPCRequest &request) { CTransactionRef optAuthTx; std::set auths; rawTx.vin = - GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, request.params[1]); + GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[1], request.metadata.coinSelectOpts); auto vocFee = GetProposalCreationFee(targetHeight, *pcustomcsview, pm); rawTx.vout.emplace_back(CTxOut(vocFee, scriptMeta)); @@ -434,7 +434,7 @@ UniValue creategovvoc(const JSONRPCRequest &request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -564,7 +564,7 @@ UniValue votegov(const JSONRPCRequest &request) { CTransactionRef optAuthTx; std::set auths = {GetScriptForDestination(ownerDest)}; rawTx.vin = - GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, request.params[3], request.metadata.coinSelectOpts); + GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[3], request.metadata.coinSelectOpts); rawTx.vout.emplace_back(CTxOut(0, scriptMeta)); @@ -720,12 +720,7 @@ UniValue votegovbatch(const JSONRPCRequest &request) { CTransactionRef optAuthTx; std::set auths = {GetScriptForDestination(ownerDest)}; - rawTx.vin = GetAuthInputsSmart(pwallet, - rawTx.nVersion, - auths, false /*needFoundersAuth*/, - optAuthTx, - {}, - request.metadata.coinSelectOpts); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, {}, request.metadata.coinSelectOpts); rawTx.vout.emplace_back(0, scriptMeta); CCoinControl coinControl; diff --git a/src/masternodes/rpc_tokens.cpp b/src/masternodes/rpc_tokens.cpp index 2d7ed94eae..392085553b 100644 --- a/src/masternodes/rpc_tokens.cpp +++ b/src/masternodes/rpc_tokens.cpp @@ -112,7 +112,7 @@ UniValue createtoken(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, metaObj["isDAT"].getBool() /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, metaObj["isDAT"].getBool(), optAuthTx, txInputs, request.metadata.coinSelectOpts); rawTx.vout.push_back(CTxOut(GetTokenCreationFee(targetHeight), scriptMeta)); rawTx.vout.push_back(CTxOut(GetTokenCollateralAmount(), GetScriptForDestination(collateralDest))); @@ -128,7 +128,7 @@ UniValue createtoken(const JSONRPCRequest& request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -274,7 +274,7 @@ UniValue updatetoken(const JSONRPCRequest& request) { } // before BayfrontHeight it needs only founders auth - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths /*auths*/, true /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); } else { // post-bayfront auth @@ -289,11 +289,11 @@ UniValue updatetoken(const JSONRPCRequest& request) { Params().GetConsensus().foundationMembers.find(owner) != Params().GetConsensus().foundationMembers.end(); if (isFoundersToken) { // need any founder's auth - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths /*auths*/, true /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, true, optAuthTx, txInputs, request.metadata.coinSelectOpts); } else {// "common" auth auths.insert(owner); - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); } } @@ -323,7 +323,7 @@ UniValue updatetoken(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -764,7 +764,7 @@ UniValue minttokens(const JSONRPCRequest& request) { } } - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, needFoundersAuth, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, needFoundersAuth, optAuthTx, txInputs, request.metadata.coinSelectOpts); CDataStream metadata(DfTxMarker, SER_NETWORK, PROTOCOL_VERSION); metadata << static_cast(CustomTxType::MintToken) << mintTokensMessage; @@ -786,7 +786,7 @@ UniValue minttokens(const JSONRPCRequest& request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -888,7 +888,7 @@ UniValue burntokens(const JSONRPCRequest& request) { CMutableTransaction rawTx(txVersion); CTransactionRef optAuthTx; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CDataStream metadata(DfTxMarker, SER_NETWORK, PROTOCOL_VERSION); metadata << static_cast(CustomTxType::BurnToken) @@ -911,7 +911,7 @@ UniValue burntokens(const JSONRPCRequest& request) { } // fund - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); diff --git a/src/masternodes/rpc_vault.cpp b/src/masternodes/rpc_vault.cpp index 39511bba73..409861b92c 100644 --- a/src/masternodes/rpc_vault.cpp +++ b/src/masternodes/rpc_vault.cpp @@ -327,7 +327,7 @@ UniValue createvault(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[2]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[2], request.metadata.coinSelectOpts); rawTx.vout.emplace_back(Params().GetConsensus().vaultCreationFee, scriptMeta); @@ -342,7 +342,7 @@ UniValue createvault(const JSONRPCRequest& request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -419,7 +419,7 @@ UniValue closevault(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{ownerAddress}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[2]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[2], request.metadata.coinSelectOpts); rawTx.vout.emplace_back(0, scriptMeta); @@ -432,7 +432,7 @@ UniValue closevault(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -733,7 +733,7 @@ UniValue updatevault(const JSONRPCRequest& request) { UniValue const &txInputs = request.params[2]; CTransactionRef optAuthTx; std::set auths{vault.ownerAddress}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -746,7 +746,7 @@ UniValue updatevault(const JSONRPCRequest& request) { } } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -821,7 +821,7 @@ UniValue deposittovault(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{from}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -832,7 +832,7 @@ UniValue deposittovault(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -919,7 +919,7 @@ UniValue withdrawfromvault(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{ownerAddress}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, txInputs); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, txInputs, request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -930,7 +930,7 @@ UniValue withdrawfromvault(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx); @@ -1021,7 +1021,7 @@ UniValue placeauctionbid(const JSONRPCRequest& request) { CTransactionRef optAuthTx; std::set auths{from}; - rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false /*needFoundersAuth*/, optAuthTx, request.params[4]); + rawTx.vin = GetAuthInputsSmart(pwallet, rawTx.nVersion, auths, false, optAuthTx, request.params[4], request.metadata.coinSelectOpts); CCoinControl coinControl; @@ -1032,7 +1032,7 @@ UniValue placeauctionbid(const JSONRPCRequest& request) { coinControl.destChange = dest; } - fund(rawTx, pwallet, optAuthTx, &coinControl); + fund(rawTx, pwallet, optAuthTx, &coinControl, request.metadata.coinSelectOpts); // check execution execTestTx(CTransaction(rawTx), targetHeight, optAuthTx);