Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 356 Lines • ▼ Show 20 Lines | static CTransactionRef SendMoney(interfaces::Chain::Lock &locked_chain, | ||||
if (nValue <= Amount::zero()) { | if (nValue <= Amount::zero()) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount"); | throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid amount"); | ||||
} | } | ||||
if (nValue > curBalance) { | if (nValue > curBalance) { | ||||
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds"); | throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds"); | ||||
} | } | ||||
if (pwallet->GetBroadcastTransactions() && !pwallet->chain().p2pEnabled()) { | |||||
throw JSONRPCError( | |||||
RPC_CLIENT_P2P_DISABLED, | |||||
"Error: Peer-to-peer functionality missing or disabled"); | |||||
} | |||||
// Parse Bitcoin address | // Parse Bitcoin address | ||||
CScript scriptPubKey = GetScriptForDestination(address); | CScript scriptPubKey = GetScriptForDestination(address); | ||||
// Create and send the transaction | // Create and send the transaction | ||||
Amount nFeeRequired; | Amount nFeeRequired; | ||||
std::string strError; | std::string strError; | ||||
std::vector<CRecipient> vecSend; | std::vector<CRecipient> vecSend; | ||||
int nChangePosRet = -1; | int nChangePosRet = -1; | ||||
▲ Show 20 Lines • Show All 611 Lines • ▼ Show 20 Lines | static UniValue sendmany(const Config &config, const JSONRPCRequest &request) { | ||||
// Make sure the results are valid at least up to the most recent block | // Make sure the results are valid at least up to the most recent block | ||||
// the user could have gotten from another RPC command prior to now | // the user could have gotten from another RPC command prior to now | ||||
pwallet->BlockUntilSyncedToCurrentChain(); | pwallet->BlockUntilSyncedToCurrentChain(); | ||||
auto locked_chain = pwallet->chain().lock(); | auto locked_chain = pwallet->chain().lock(); | ||||
LOCK(pwallet->cs_wallet); | LOCK(pwallet->cs_wallet); | ||||
if (pwallet->GetBroadcastTransactions() && !pwallet->chain().p2pEnabled()) { | |||||
throw JSONRPCError( | |||||
RPC_CLIENT_P2P_DISABLED, | |||||
"Error: Peer-to-peer functionality missing or disabled"); | |||||
} | |||||
if (!request.params[0].isNull() && !request.params[0].get_str().empty()) { | if (!request.params[0].isNull() && !request.params[0].get_str().empty()) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"Dummy value must be set to \"\""); | "Dummy value must be set to \"\""); | ||||
} | } | ||||
UniValue sendTo = request.params[1].get_obj(); | UniValue sendTo = request.params[1].get_obj(); | ||||
mapValue_t mapValue; | mapValue_t mapValue; | ||||
if (!request.params[3].isNull() && !request.params[3].get_str().empty()) { | if (!request.params[3].isNull() && !request.params[3].get_str().empty()) { | ||||
▲ Show 20 Lines • Show All 3,782 Lines • Show Last 20 Lines |