@@ -1732,9 +1732,12 @@ RPCHelpMan walletdeniabilizecoin()
17321732 {
17331733 {" inputs" , RPCArg::Type::ARR, RPCArg::Optional::NO, " Specify inputs (must share the same address). A JSON array of JSON objects" ,
17341734 {
1735- {" txid" , RPCArg::Type::STR_HEX, RPCArg::Optional::NO, " The transaction id" },
1736- {" vout" , RPCArg::Type::NUM, RPCArg::Optional::NO, " The output number" },
1737- {" sequence" , RPCArg::Type::NUM, RPCArg::Optional::NO, " The sequence number" },
1735+ {" " , RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, " " ,
1736+ {
1737+ {" txid" , RPCArg::Type::STR_HEX, RPCArg::Optional::NO, " The transaction id" },
1738+ {" vout" , RPCArg::Type::NUM, RPCArg::Optional::NO, " The output number" },
1739+ }
1740+ }
17381741 },
17391742 },
17401743 {" conf_target" , RPCArg::Type::NUM, RPCArg::DefaultHint{" wallet -txconfirmtarget" }, " Confirmation target in blocks" },
@@ -1748,24 +1751,29 @@ RPCHelpMan walletdeniabilizecoin()
17481751 {RPCResult::Type::STR_HEX, " hex" , /* optional=*/ true , " If add_to_wallet is false, the hex-encoded raw transaction with signature(s)" },
17491752 }
17501753 },
1751- RPCExamples{" "
1754+ RPCExamples{
1755+ " \n Deniabilize a single UTXO\n "
1756+ + HelpExampleCli (" walletdeniabilizecoin" , " \" [{\" txid\" :\" 4c14d20709daef476854fe7ef75bdfcfd5a7636a431b4622ec9481f297e12e8c\" , \" vout\" : 0}]\" " )
17521757 },
17531758 [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
17541759 {
17551760 std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest (request);
17561761 if (!pwallet) return UniValue::VNULL;
17571762
1758- CMutableTransaction rawTx;
1759- AddInputs (rawTx, request.params [0 ], true );
1760-
1761- unsigned int confirm_target = !request.params [1 ].isNull () ? request.params [1 ].getInt <unsigned int >() : 6 ;
1762- const bool add_to_wallet = !request.params [2 ].isNull () ? request.params [2 ].get_bool () : true ;
1763-
17641763 std::optional<CTxDestination> shared_address;
17651764 std::set<COutPoint> inputs;
17661765 unsigned int deniabilization_cycles = 0 ;
1767- for (const auto & txIn: rawTx.vin ) {
1768- const auto & outpoint = txIn.prevout ;
1766+ for (const UniValue& input : request.params [0 ].get_array ().getValues ()) {
1767+ uint256 txid = ParseHashO (input, " txid" );
1768+
1769+ const UniValue& vout_v = input.find_value (" vout" );
1770+ if (!vout_v.isNum ())
1771+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid parameter, missing vout key" );
1772+ int nOutput = vout_v.getInt <int >();
1773+ if (nOutput < 0 )
1774+ throw JSONRPCError (RPC_INVALID_PARAMETER, " Invalid parameter, vout cannot be negative" );
1775+
1776+ COutPoint outpoint (txid, nOutput);
17691777 LOCK (pwallet->cs_wallet );
17701778 auto walletTx = pwallet->GetWalletTx (outpoint.hash );
17711779 if (!walletTx) {
@@ -1797,6 +1805,9 @@ RPCHelpMan walletdeniabilizecoin()
17971805 deniabilization_cycles = std::min (deniabilization_cycles, cycles_res.first );
17981806 }
17991807
1808+ unsigned int confirm_target = !request.params [1 ].isNull () ? request.params [1 ].getInt <unsigned int >() : 6 ;
1809+ const bool add_to_wallet = !request.params [2 ].isNull () ? request.params [2 ].get_bool () : true ;
1810+
18001811 CTransactionRef tx;
18011812 CAmount tx_fee = 0 ;
18021813 {
0 commit comments