@@ -1732,9 +1732,12 @@ RPCHelpMan walletdeniabilizecoin()
1732
1732
{
1733
1733
{" inputs" , RPCArg::Type::ARR, RPCArg::Optional::NO, " Specify inputs (must share the same address). A JSON array of JSON objects" ,
1734
1734
{
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
+ }
1738
1741
},
1739
1742
},
1740
1743
{" conf_target" , RPCArg::Type::NUM, RPCArg::DefaultHint{" wallet -txconfirmtarget" }, " Confirmation target in blocks" },
@@ -1748,24 +1751,29 @@ RPCHelpMan walletdeniabilizecoin()
1748
1751
{RPCResult::Type::STR_HEX, " hex" , /* optional=*/ true , " If add_to_wallet is false, the hex-encoded raw transaction with signature(s)" },
1749
1752
}
1750
1753
},
1751
- RPCExamples{" "
1754
+ RPCExamples{
1755
+ " \n Deniabilize a single UTXO\n "
1756
+ + HelpExampleCli (" walletdeniabilizecoin" , " \" [{\" txid\" :\" 4c14d20709daef476854fe7ef75bdfcfd5a7636a431b4622ec9481f297e12e8c\" , \" vout\" : 0}]\" " )
1752
1757
},
1753
1758
[&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue
1754
1759
{
1755
1760
std::shared_ptr<CWallet> const pwallet = GetWalletForJSONRPCRequest (request);
1756
1761
if (!pwallet) return UniValue::VNULL;
1757
1762
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
-
1764
1763
std::optional<CTxDestination> shared_address;
1765
1764
std::set<COutPoint> inputs;
1766
1765
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);
1769
1777
LOCK (pwallet->cs_wallet );
1770
1778
auto walletTx = pwallet->GetWalletTx (outpoint.hash );
1771
1779
if (!walletTx) {
@@ -1797,6 +1805,9 @@ RPCHelpMan walletdeniabilizecoin()
1797
1805
deniabilization_cycles = std::min (deniabilization_cycles, cycles_res.first );
1798
1806
}
1799
1807
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
+
1800
1811
CTransactionRef tx;
1801
1812
CAmount tx_fee = 0 ;
1802
1813
{
0 commit comments