Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | |||||
void EnsureWalletIsUnlocked(CWallet *const pwallet) { | void EnsureWalletIsUnlocked(CWallet *const pwallet) { | ||||
if (pwallet->IsLocked()) { | if (pwallet->IsLocked()) { | ||||
throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the " | throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the " | ||||
"wallet passphrase with " | "wallet passphrase with " | ||||
"walletpassphrase first."); | "walletpassphrase first."); | ||||
} | } | ||||
} | } | ||||
static void WalletTxToJSON(const CWalletTx &wtx, UniValue &entry) { | static void WalletTxToJSON(const CWalletTx &wtx, UniValue &entry) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | |||||
int confirms = wtx.GetDepthInMainChain(); | int confirms = wtx.GetDepthInMainChain(); | ||||
entry.pushKV("confirmations", confirms); | entry.pushKV("confirmations", confirms); | ||||
if (wtx.IsCoinBase()) { | if (wtx.IsCoinBase()) { | ||||
entry.pushKV("generated", true); | entry.pushKV("generated", true); | ||||
} | } | ||||
if (confirms > 0) { | if (confirms > 0) { | ||||
entry.pushKV("blockhash", wtx.hashBlock.GetHex()); | entry.pushKV("blockhash", wtx.hashBlock.GetHex()); | ||||
entry.pushKV("blockindex", wtx.nIndex); | entry.pushKV("blockindex", wtx.nIndex); | ||||
▲ Show 20 Lines • Show All 1,367 Lines • ▼ Show 20 Lines | struct tallyitem { | ||||
tallyitem() { | tallyitem() { | ||||
nAmount = Amount::zero(); | nAmount = Amount::zero(); | ||||
nConf = std::numeric_limits<int>::max(); | nConf = std::numeric_limits<int>::max(); | ||||
fIsWatchonly = false; | fIsWatchonly = false; | ||||
} | } | ||||
}; | }; | ||||
static UniValue ListReceived(const Config &config, CWallet *const pwallet, | static UniValue ListReceived(const Config &config, CWallet *const pwallet, | ||||
const UniValue ¶ms, bool by_label) { | const UniValue ¶ms, bool by_label) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | |||||
// Minimum confirmations | // Minimum confirmations | ||||
int nMinDepth = 1; | int nMinDepth = 1; | ||||
if (!params[0].isNull()) { | if (!params[0].isNull()) { | ||||
nMinDepth = params[0].get_int(); | nMinDepth = params[0].get_int(); | ||||
} | } | ||||
// Whether to include empty labels | // Whether to include empty labels | ||||
bool fIncludeEmpty = false; | bool fIncludeEmpty = false; | ||||
▲ Show 20 Lines • Show All 271 Lines • ▼ Show 20 Lines | |||||
* @param nMinDepth The minimum confirmation depth. | * @param nMinDepth The minimum confirmation depth. | ||||
* @param fLong Whether to include the JSON version of the transaction. | * @param fLong Whether to include the JSON version of the transaction. | ||||
* @param ret The UniValue into which the result is stored. | * @param ret The UniValue into which the result is stored. | ||||
* @param filter The "is mine" filter bool. | * @param filter The "is mine" filter bool. | ||||
*/ | */ | ||||
static void ListTransactions(CWallet *const pwallet, const CWalletTx &wtx, | static void ListTransactions(CWallet *const pwallet, const CWalletTx &wtx, | ||||
const std::string &strAccount, int nMinDepth, | const std::string &strAccount, int nMinDepth, | ||||
bool fLong, UniValue &ret, | bool fLong, UniValue &ret, | ||||
const isminefilter &filter) { | const isminefilter &filter) | ||||
EXCLUSIVE_LOCKS_REQUIRED(cs_main) { | |||||
Amount nFee; | Amount nFee; | ||||
std::string strSentAccount; | std::string strSentAccount; | ||||
std::list<COutputEntry> listReceived; | std::list<COutputEntry> listReceived; | ||||
std::list<COutputEntry> listSent; | std::list<COutputEntry> listSent; | ||||
wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount, filter); | wtx.GetAmounts(listReceived, listSent, nFee, strSentAccount, filter); | ||||
bool fAllAccounts = (strAccount == std::string("*")); | bool fAllAccounts = (strAccount == std::string("*")); | ||||
▲ Show 20 Lines • Show All 2,573 Lines • Show Last 20 Lines |