Advertisement
Guest User

Untitled

a guest
Aug 3rd, 2014
576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. Value darksend(const Array& params, bool fHelp)
  2. {
  3. if (fHelp || params.size() == 0)
  4. throw runtime_error(
  5. "darksend <darkcoinaddress> <amount>\n"
  6. "darkcoinaddress, reset, or auto (AutoDenominate)"
  7. "<amount> is a real and is rounded to the nearest 0.00000001"
  8. + HelpRequiringPassphrase());
  9.  
  10. if(fMasterNode)
  11. return "DarkSend is not supported from masternodes";
  12.  
  13. if (pwalletMain->IsLocked())
  14. throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first.");
  15.  
  16. if(params[0].get_str() == "auto"){
  17. darkSendPool.DoAutomaticDenominating();
  18. return "DoAutomaticDenominating";
  19. }
  20.  
  21. if(params[0].get_str() == "reset"){
  22. darkSendPool.SetNull(true);
  23. return "successfully reset darksend";
  24. }
  25.  
  26. if (params.size() != 2)
  27. throw runtime_error(
  28. "darksend <darkcoinaddress> <amount>\n"
  29. "darkcoinaddress, denominate, or auto (AutoDenominate)"
  30. "<amount> is a real and is rounded to the nearest 0.00000001"
  31. + HelpRequiringPassphrase());
  32.  
  33. CBitcoinAddress address(params[0].get_str());
  34. if (!address.IsValid() && params[0].get_str() != "denominate" )
  35. throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid DarkCoin address");
  36.  
  37. // Amount
  38. int64 nAmount = AmountFromValue(params[1]);
  39.  
  40. // Wallet comments
  41. CWalletTx wtx;
  42. string strError = pwalletMain->SendMoneyToDestination(address.Get(), nAmount, wtx, false, ONLY_DENOMINATED);
  43. if (strError != "")
  44. throw JSONRPCError(RPC_WALLET_ERROR, strError);
  45.  
  46. return darkSendPool.lastMessage;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement