Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 368 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() && !g_connman) { | if (pwallet->GetBroadcastTransactions() && !pwallet->chain().p2pEnabled()) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_CLIENT_P2P_DISABLED, | RPC_CLIENT_P2P_DISABLED, | ||||
"Error: Peer-to-peer functionality missing or disabled"); | "Error: Peer-to-peer functionality missing or disabled"); | ||||
} | } | ||||
// Parse Bitcoin address | // Parse Bitcoin address | ||||
CScript scriptPubKey = GetScriptForDestination(address); | CScript scriptPubKey = GetScriptForDestination(address); | ||||
▲ Show 20 Lines • Show All 652 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() && !g_connman) { | if (pwallet->GetBroadcastTransactions() && !pwallet->chain().p2pEnabled()) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_CLIENT_P2P_DISABLED, | RPC_CLIENT_P2P_DISABLED, | ||||
"Error: Peer-to-peer functionality missing or 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 \"\""); | ||||
▲ Show 20 Lines • Show All 2,234 Lines • ▼ Show 20 Lines | if (request.fHelp || request.params.size() != 0) { | ||||
"periodically re-broadcasts\n", | "periodically re-broadcasts\n", | ||||
{}} | {}} | ||||
.ToString() + | .ToString() + | ||||
"automatically.\n" | "automatically.\n" | ||||
"Returns an RPC error if -walletbroadcast is set to false.\n" | "Returns an RPC error if -walletbroadcast is set to false.\n" | ||||
"Returns array of transaction ids that were re-broadcast.\n"); | "Returns array of transaction ids that were re-broadcast.\n"); | ||||
} | } | ||||
if (!g_connman) { | if (!pwallet->chain().p2pEnabled()) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_CLIENT_P2P_DISABLED, | RPC_CLIENT_P2P_DISABLED, | ||||
"Error: Peer-to-peer functionality missing or disabled"); | "Error: Peer-to-peer functionality missing or disabled"); | ||||
} | } | ||||
auto locked_chain = pwallet->chain().lock(); | auto locked_chain = pwallet->chain().lock(); | ||||
LOCK(pwallet->cs_wallet); | LOCK(pwallet->cs_wallet); | ||||
▲ Show 20 Lines • Show All 1,605 Lines • Show Last 20 Lines |