Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Value darksend(const Array& params, bool fHelp)
- {
- if (fHelp || params.size() == 0)
- throw runtime_error(
- "darksend <darkcoinaddress> <amount>\n"
- "darkcoinaddress, reset, or auto (AutoDenominate)"
- "<amount> is a real and is rounded to the nearest 0.00000001"
- + HelpRequiringPassphrase());
- if(fMasterNode)
- return "DarkSend is not supported from masternodes";
- if (pwalletMain->IsLocked())
- throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
- if(params[0].get_str() == "auto"){
- darkSendPool.DoAutomaticDenominating();
- return "DoAutomaticDenominating";
- }
- if(params[0].get_str() == "reset"){
- darkSendPool.SetNull(true);
- return "successfully reset darksend";
- }
- if (params.size() != 2)
- throw runtime_error(
- "darksend <darkcoinaddress> <amount>\n"
- "darkcoinaddress, denominate, or auto (AutoDenominate)"
- "<amount> is a real and is rounded to the nearest 0.00000001"
- + HelpRequiringPassphrase());
- CBitcoinAddress address(params[0].get_str());
- if (!address.IsValid() && params[0].get_str() != "denominate" )
- throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid DarkCoin address");
- // Amount
- int64 nAmount = AmountFromValue(params[1]);
- // Wallet comments
- CWalletTx wtx;
- string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx, false, ONLY_DENOMINATED);
- if (strError != "")
- throw JSONRPCError(RPC_WALLET_ERROR, strError);
- return darkSendPool.lastMessage;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement