Skip to content

Commit 5454f3c

Browse files
committed
Remove the no longer supported obfuscation RPC command
1 parent 38f226e commit 5454f3c

File tree

3 files changed

+2
-88
lines changed

3 files changed

+2
-88
lines changed

src/rpcmasternode.cpp

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -19,90 +19,6 @@
1919
#include <boost/tokenizer.hpp>
2020
#include <fstream>
2121

22-
23-
void SendMoney(const CTxDestination& address, CAmount nValue, CWalletTx& wtxNew, AvailableCoinsType coin_type = ALL_COINS)
24-
{
25-
// Check amount
26-
if (nValue <= 0)
27-
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount");
28-
29-
if (nValue > pwalletMain->GetBalance())
30-
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds");
31-
32-
string strError;
33-
if (pwalletMain->IsLocked()) {
34-
strError = "Error: Wallet locked, unable to create transaction!";
35-
LogPrintf("SendMoney() : %s", strError);
36-
throw JSONRPCError(RPC_WALLET_ERROR, strError);
37-
}
38-
39-
// Parse Pivx address
40-
CScript scriptPubKey = GetScriptForDestination(address);
41-
42-
// Create and send the transaction
43-
CReserveKey reservekey(pwalletMain);
44-
CAmount nFeeRequired;
45-
if (!pwalletMain->CreateTransaction(scriptPubKey, nValue, wtxNew, reservekey, nFeeRequired, strError, NULL, coin_type)) {
46-
if (nValue + nFeeRequired > pwalletMain->GetBalance())
47-
strError = strprintf("Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!", FormatMoney(nFeeRequired));
48-
LogPrintf("SendMoney() : %s\n", strError);
49-
throw JSONRPCError(RPC_WALLET_ERROR, strError);
50-
}
51-
if (!pwalletMain->CommitTransaction(wtxNew, reservekey))
52-
throw JSONRPCError(RPC_WALLET_ERROR, "Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.");
53-
}
54-
55-
UniValue obfuscation(const UniValue& params, bool fHelp)
56-
{
57-
throw runtime_error("Obfuscation is not supported any more. Use Zerocoin\n");
58-
59-
if (fHelp || params.size() == 0)
60-
throw runtime_error(
61-
"obfuscation <pivxaddress> <amount>\n"
62-
"pivxaddress, reset, or auto (AutoDenominate)"
63-
"<amount> is a real and will be rounded to the next 0.1" +
64-
HelpRequiringPassphrase());
65-
66-
if (pwalletMain->IsLocked())
67-
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
68-
69-
if (params[0].get_str() == "auto") {
70-
if (fMasterNode)
71-
return "ObfuScation is not supported from masternodes";
72-
73-
return "DoAutomaticDenominating " + (obfuScationPool.DoAutomaticDenominating() ? "successful" : ("failed: " + obfuScationPool.GetStatus()));
74-
}
75-
76-
if (params[0].get_str() == "reset") {
77-
obfuScationPool.Reset();
78-
return "successfully reset obfuscation";
79-
}
80-
81-
if (params.size() != 2)
82-
throw runtime_error(
83-
"obfuscation <pivxaddress> <amount>\n"
84-
"pivxaddress, denominate, or auto (AutoDenominate)"
85-
"<amount> is a real and will be rounded to the next 0.1" +
86-
HelpRequiringPassphrase());
87-
88-
CBitcoinAddress address(params[0].get_str());
89-
if (!address.IsValid())
90-
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Pivx address");
91-
92-
// Amount
93-
CAmount nAmount = AmountFromValue(params[1]);
94-
95-
// Wallet comments
96-
CWalletTx wtx;
97-
// string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx, ONLY_DENOMINATED);
98-
SendMoney(address.Get(), nAmount, wtx, ONLY_DENOMINATED);
99-
// if (strError != "")
100-
// throw JSONRPCError(RPC_WALLET_ERROR, strError);
101-
102-
return wtx.GetHash().GetHex();
103-
}
104-
105-
10622
UniValue getpoolinfo(const UniValue& params, bool fHelp)
10723
{
10824
if (fHelp || params.size() != 0)

src/rpcserver.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,8 @@ static const CRPCCommand vRPCCommands[] =
381381
{"pivx", "mnsync", &mnsync, true, true, false},
382382
{"pivx", "spork", &spork, true, true, false},
383383
{"pivx", "getpoolinfo", &getpoolinfo, true, true, false},
384-
#ifdef ENABLE_WALLET
385-
{"pivx", "obfuscation", &obfuscation, false, false, true}, /* not threadSafe because of SendMoney */
386384

385+
#ifdef ENABLE_WALLET
387386
/* Wallet */
388387
{"wallet", "addmultisigaddress", &addmultisigaddress, true, false, true},
389388
{"wallet", "autocombinerewards", &autocombinerewards, false, false, true},

src/rpcserver.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,7 @@ extern UniValue getchaintips(const UniValue& params, bool fHelp);
291291
extern UniValue invalidateblock(const UniValue& params, bool fHelp);
292292
extern UniValue reconsiderblock(const UniValue& params, bool fHelp);
293293

294-
extern UniValue obfuscation(const UniValue& params, bool fHelp); // in rpcmasternode.cpp
295-
extern UniValue getpoolinfo(const UniValue& params, bool fHelp);
294+
extern UniValue getpoolinfo(const UniValue& params, bool fHelp); // in rpcmasternode.cpp
296295
extern UniValue masternode(const UniValue& params, bool fHelp);
297296
extern UniValue listmasternodes(const UniValue& params, bool fHelp);
298297
extern UniValue getmasternodecount(const UniValue& params, bool fHelp);

0 commit comments

Comments
 (0)