Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 798 Lines • ▼ Show 20 Lines | static UniValue getreceivedbyaddress(const Config &config, | ||||
// Minimum confirmations | // Minimum confirmations | ||||
int nMinDepth = 1; | int nMinDepth = 1; | ||||
if (!request.params[1].isNull()) { | if (!request.params[1].isNull()) { | ||||
nMinDepth = request.params[1].get_int(); | nMinDepth = request.params[1].get_int(); | ||||
} | } | ||||
// Tally | // Tally | ||||
Amount nAmount = Amount::zero(); | Amount nAmount = Amount::zero(); | ||||
for (const std::pair<const uint256, CWalletTx> &pairWtx : | for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | ||||
pwallet->mapWallet) { | |||||
const CWalletTx &wtx = pairWtx.second; | const CWalletTx &wtx = pairWtx.second; | ||||
CValidationState state; | CValidationState state; | ||||
if (wtx.IsCoinBase() || !ContextualCheckTransactionForCurrentBlock( | if (wtx.IsCoinBase() || !ContextualCheckTransactionForCurrentBlock( | ||||
config, *wtx.tx, state)) { | config, *wtx.tx, state)) { | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | static UniValue getreceivedbylabel(const Config &config, | ||||
} | } | ||||
// Get the set of pub keys assigned to label | // Get the set of pub keys assigned to label | ||||
std::string label = LabelFromValue(request.params[0]); | std::string label = LabelFromValue(request.params[0]); | ||||
std::set<CTxDestination> setAddress = pwallet->GetLabelAddresses(label); | std::set<CTxDestination> setAddress = pwallet->GetLabelAddresses(label); | ||||
// Tally | // Tally | ||||
Amount nAmount = Amount::zero(); | Amount nAmount = Amount::zero(); | ||||
for (const std::pair<const uint256, CWalletTx> &pairWtx : | for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | ||||
pwallet->mapWallet) { | |||||
const CWalletTx &wtx = pairWtx.second; | const CWalletTx &wtx = pairWtx.second; | ||||
CValidationState state; | CValidationState state; | ||||
if (wtx.IsCoinBase() || !ContextualCheckTransactionForCurrentBlock( | if (wtx.IsCoinBase() || !ContextualCheckTransactionForCurrentBlock( | ||||
config, *wtx.tx, state)) { | config, *wtx.tx, state)) { | ||||
continue; | continue; | ||||
} | } | ||||
for (const CTxOut &txout : wtx.tx->vout) { | for (const CTxOut &txout : wtx.tx->vout) { | ||||
▲ Show 20 Lines • Show All 628 Lines • ▼ Show 20 Lines | if (!by_label && params.size() > 3) { | ||||
} | } | ||||
filtered_address = | filtered_address = | ||||
DecodeDestination(params[3].get_str(), config.GetChainParams()); | DecodeDestination(params[3].get_str(), config.GetChainParams()); | ||||
has_filtered_address = true; | has_filtered_address = true; | ||||
} | } | ||||
// Tally | // Tally | ||||
std::map<CTxDestination, tallyitem> mapTally; | std::map<CTxDestination, tallyitem> mapTally; | ||||
for (const std::pair<const uint256, CWalletTx> &pairWtx : | for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | ||||
pwallet->mapWallet) { | |||||
const CWalletTx &wtx = pairWtx.second; | const CWalletTx &wtx = pairWtx.second; | ||||
CValidationState state; | CValidationState state; | ||||
if (wtx.IsCoinBase() || !ContextualCheckTransactionForCurrentBlock( | if (wtx.IsCoinBase() || !ContextualCheckTransactionForCurrentBlock( | ||||
config, *wtx.tx, state)) { | config, *wtx.tx, state)) { | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 585 Lines • ▼ Show 20 Lines | static UniValue listaccounts(const Config &config, | ||||
for (const std::pair<const CTxDestination, CAddressBookData> &entry : | for (const std::pair<const CTxDestination, CAddressBookData> &entry : | ||||
pwallet->mapAddressBook) { | pwallet->mapAddressBook) { | ||||
// This address belongs to me | // This address belongs to me | ||||
if (IsMine(*pwallet, entry.first) & includeWatchonly) { | if (IsMine(*pwallet, entry.first) & includeWatchonly) { | ||||
mapAccountBalances[entry.second.name] = Amount::zero(); | mapAccountBalances[entry.second.name] = Amount::zero(); | ||||
} | } | ||||
} | } | ||||
for (const std::pair<const uint256, CWalletTx> &pairWtx : | for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | ||||
pwallet->mapWallet) { | |||||
const CWalletTx &wtx = pairWtx.second; | const CWalletTx &wtx = pairWtx.second; | ||||
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; | ||||
int nDepth = wtx.GetDepthInMainChain(); | int nDepth = wtx.GetDepthInMainChain(); | ||||
if (wtx.IsImmatureCoinBase() || nDepth < 0) { | if (wtx.IsImmatureCoinBase() || nDepth < 0) { | ||||
continue; | continue; | ||||
▲ Show 20 Lines • Show All 187 Lines • ▼ Show 20 Lines | static UniValue listsinceblock(const Config &config, | ||||
bool include_removed = | bool include_removed = | ||||
(request.params[3].isNull() || request.params[3].get_bool()); | (request.params[3].isNull() || request.params[3].get_bool()); | ||||
int depth = pindex ? (1 + chainActive.Height() - pindex->nHeight) : -1; | int depth = pindex ? (1 + chainActive.Height() - pindex->nHeight) : -1; | ||||
UniValue transactions(UniValue::VARR); | UniValue transactions(UniValue::VARR); | ||||
for (const std::pair<const uint256, CWalletTx> &pairWtx : | for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | ||||
pwallet->mapWallet) { | |||||
CWalletTx tx = pairWtx.second; | CWalletTx tx = pairWtx.second; | ||||
if (depth == -1 || tx.GetDepthInMainChain() < depth) { | if (depth == -1 || tx.GetDepthInMainChain() < depth) { | ||||
ListTransactions(pwallet, tx, "*", 0, true, transactions, filter); | ListTransactions(pwallet, tx, "*", 0, true, transactions, filter); | ||||
} | } | ||||
} | } | ||||
// when a reorg'd block is requested, we also list any relevant transactions | // when a reorg'd block is requested, we also list any relevant transactions | ||||
▲ Show 20 Lines • Show All 2,022 Lines • Show Last 20 Lines |