| 60 | } |
| 61 | |
| 62 | UniValue darksend(const UniValue& params, bool fHelp) { |
| 63 | if (fHelp || params.size() == 0) |
| 64 | throw runtime_error( |
| 65 | "darksend <Luxaddress> <amount>\n" |
| 66 | "Luxaddress, reset, or auto (AutoDenominate)" |
| 67 | "<amount> is a real and is rounded to the nearest 0.00000001" |
| 68 | + HelpRequiringPassphrase()); |
| 69 | |
| 70 | if (pwalletMain->IsLocked()) |
| 71 | throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); |
| 72 | |
| 73 | if (params[0].get_str() == "auto") { |
| 74 | if (fMasterNode) |
| 75 | return "DarkSend is not supported from masternodes"; |
| 76 | |
| 77 | darkSendPool.DoAutomaticDenominating(); |
| 78 | return "DoAutomaticDenominating"; |
| 79 | } |
| 80 | |
| 81 | if (params[0].get_str() == "reset") { |
| 82 | darkSendPool.SetNull(true); |
| 83 | darkSendPool.UnlockCoins(); |
| 84 | return "successfully reset darksend"; |
| 85 | } |
| 86 | |
| 87 | if (params.size() != 2) |
| 88 | throw runtime_error( |
| 89 | "darksend <Luxaddress> <amount>\n" |
| 90 | "Luxaddress, denominate, or auto (AutoDenominate)" |
| 91 | "<amount> is a real and is rounded to the nearest 0.00000001" |
| 92 | + HelpRequiringPassphrase()); |
| 93 | |
| 94 | CTxDestination dest = DecodeDestination(params[0].get_str()); |
| 95 | if (!IsValidDestination(dest)) |
| 96 | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid Lux address"); |
| 97 | |
| 98 | // Amount |
| 99 | int64_t nAmount = AmountFromValue(params[1]); |
| 100 | |
| 101 | // Wallet comments |
| 102 | CWalletTx wtx; |
| 103 | SendMoney(dest, nAmount, wtx, ONLY_DENOMINATED); |
| 104 | |
| 105 | return wtx.GetHash().GetHex(); |
| 106 | } |
| 107 | |
| 108 | |
| 109 | UniValue getpoolinfo(const UniValue& params, bool fHelp) { |
nothing calls this directly
no test coverage detected