Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Lines | if (confirms > 0) { | ||||
entry.pushKV("blockhash", wtx.m_confirm.hashBlock.GetHex()); | entry.pushKV("blockhash", wtx.m_confirm.hashBlock.GetHex()); | ||||
entry.pushKV("blockheight", wtx.m_confirm.block_height); | entry.pushKV("blockheight", wtx.m_confirm.block_height); | ||||
entry.pushKV("blockindex", wtx.m_confirm.nIndex); | entry.pushKV("blockindex", wtx.m_confirm.nIndex); | ||||
int64_t block_time; | int64_t block_time; | ||||
CHECK_NONFATAL(chain.findBlock(wtx.m_confirm.hashBlock, | CHECK_NONFATAL(chain.findBlock(wtx.m_confirm.hashBlock, | ||||
FoundBlock().time(block_time))); | FoundBlock().time(block_time))); | ||||
entry.pushKV("blocktime", block_time); | entry.pushKV("blocktime", block_time); | ||||
} else { | } else { | ||||
entry.pushKV("trusted", wtx.IsTrusted(locked_chain)); | entry.pushKV("trusted", wtx.IsTrusted()); | ||||
} | } | ||||
uint256 hash = wtx.GetId(); | uint256 hash = wtx.GetId(); | ||||
entry.pushKV("txid", hash.GetHex()); | entry.pushKV("txid", hash.GetHex()); | ||||
UniValue conflicts(UniValue::VARR); | UniValue conflicts(UniValue::VARR); | ||||
for (const uint256 &conflict : wtx.GetConflicts()) { | for (const uint256 &conflict : wtx.GetConflicts()) { | ||||
conflicts.push_back(conflict.GetHex()); | conflicts.push_back(conflict.GetHex()); | ||||
} | } | ||||
entry.pushKV("walletconflicts", conflicts); | entry.pushKV("walletconflicts", conflicts); | ||||
▲ Show 20 Lines • Show All 527 Lines • ▼ Show 20 Lines | static UniValue getreceivedbyaddress(const Config &config, | ||||
// Tally | // Tally | ||||
Amount nAmount = Amount::zero(); | Amount nAmount = Amount::zero(); | ||||
for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | ||||
const CWalletTx &wtx = pairWtx.second; | const CWalletTx &wtx = pairWtx.second; | ||||
TxValidationState state; | TxValidationState state; | ||||
if (wtx.IsCoinBase() || | if (wtx.IsCoinBase() || | ||||
!locked_chain->contextualCheckTransactionForCurrentBlock( | !pwallet->chain().contextualCheckTransactionForCurrentBlock( | ||||
majcosta: not blocking because D7939 is in the pipeline. same for line 799. | |||||
wallet->chainParams.GetConsensus(), *wtx.tx, state)) { | *wtx.tx, state)) { | ||||
continue; | continue; | ||||
} | } | ||||
for (const CTxOut &txout : wtx.tx->vout) { | for (const CTxOut &txout : wtx.tx->vout) { | ||||
if (txout.scriptPubKey == scriptPubKey) { | if (txout.scriptPubKey == scriptPubKey) { | ||||
if (wtx.GetDepthInMainChain() >= nMinDepth) { | if (wtx.GetDepthInMainChain() >= nMinDepth) { | ||||
nAmount += txout.nValue; | nAmount += txout.nValue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | static UniValue getreceivedbylabel(const Config &config, | ||||
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 TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | ||||
const CWalletTx &wtx = pairWtx.second; | const CWalletTx &wtx = pairWtx.second; | ||||
TxValidationState state; | TxValidationState state; | ||||
if (wtx.IsCoinBase() || | if (wtx.IsCoinBase() || | ||||
!locked_chain->contextualCheckTransactionForCurrentBlock( | !pwallet->chain().contextualCheckTransactionForCurrentBlock( | ||||
wallet->chainParams.GetConsensus(), *wtx.tx, state)) { | *wtx.tx, state)) { | ||||
continue; | continue; | ||||
} | } | ||||
for (const CTxOut &txout : wtx.tx->vout) { | for (const CTxOut &txout : wtx.tx->vout) { | ||||
CTxDestination address; | CTxDestination address; | ||||
if (ExtractDestination(txout.scriptPubKey, address) && | if (ExtractDestination(txout.scriptPubKey, address) && | ||||
pwallet->IsMine(address) && setAddress.count(address)) { | pwallet->IsMine(address) && setAddress.count(address)) { | ||||
if (wtx.GetDepthInMainChain() >= nMinDepth) { | if (wtx.GetDepthInMainChain() >= nMinDepth) { | ||||
▲ Show 20 Lines • Show All 408 Lines • ▼ Show 20 Lines | ListReceived(const Config &config, interfaces::Chain::Lock &locked_chain, | ||||
// Tally | // Tally | ||||
std::map<CTxDestination, tallyitem> mapTally; | std::map<CTxDestination, tallyitem> mapTally; | ||||
for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | for (const std::pair<const TxId, CWalletTx> &pairWtx : pwallet->mapWallet) { | ||||
const CWalletTx &wtx = pairWtx.second; | const CWalletTx &wtx = pairWtx.second; | ||||
TxValidationState state; | TxValidationState state; | ||||
if (wtx.IsCoinBase() || | if (wtx.IsCoinBase() || | ||||
!locked_chain.contextualCheckTransactionForCurrentBlock( | !pwallet->chain().contextualCheckTransactionForCurrentBlock( | ||||
pwallet->chainParams.GetConsensus(), *wtx.tx, state)) { | *wtx.tx, state)) { | ||||
continue; | continue; | ||||
} | } | ||||
int nDepth = wtx.GetDepthInMainChain(); | int nDepth = wtx.GetDepthInMainChain(); | ||||
if (nDepth < nMinDepth) { | if (nDepth < nMinDepth) { | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,282 Lines • ▼ Show 20 Lines | static UniValue listunspent(const Config &config, | ||||
std::vector<COutput> vecOutputs; | std::vector<COutput> vecOutputs; | ||||
{ | { | ||||
CCoinControl cctl; | CCoinControl cctl; | ||||
cctl.m_avoid_address_reuse = false; | cctl.m_avoid_address_reuse = false; | ||||
cctl.m_min_depth = nMinDepth; | cctl.m_min_depth = nMinDepth; | ||||
cctl.m_max_depth = nMaxDepth; | cctl.m_max_depth = nMaxDepth; | ||||
auto locked_chain = pwallet->chain().lock(); | auto locked_chain = pwallet->chain().lock(); | ||||
LOCK(pwallet->cs_wallet); | LOCK(pwallet->cs_wallet); | ||||
pwallet->AvailableCoins(*locked_chain, vecOutputs, !include_unsafe, | pwallet->AvailableCoins(vecOutputs, !include_unsafe, &cctl, | ||||
&cctl, nMinimumAmount, nMaximumAmount, | nMinimumAmount, nMaximumAmount, | ||||
nMinimumSumAmount, nMaximumCount); | nMinimumSumAmount, nMaximumCount); | ||||
} | } | ||||
LOCK(pwallet->cs_wallet); | LOCK(pwallet->cs_wallet); | ||||
const bool avoid_reuse = pwallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE); | const bool avoid_reuse = pwallet->IsWalletFlagSet(WALLET_FLAG_AVOID_REUSE); | ||||
for (const COutput &out : vecOutputs) { | for (const COutput &out : vecOutputs) { | ||||
▲ Show 20 Lines • Show All 1,401 Lines • Show Last 20 Lines |
not blocking because D7939 is in the pipeline. same for line 799.