Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 129 Lines • ▼ Show 20 Lines | static void WalletTxToJSON(interfaces::Chain &chain, | ||||
interfaces::Chain::Lock &locked_chain, | interfaces::Chain::Lock &locked_chain, | ||||
const CWalletTx &wtx, UniValue &entry) { | const CWalletTx &wtx, UniValue &entry) { | ||||
int confirms = wtx.GetDepthInMainChain(locked_chain); | int confirms = wtx.GetDepthInMainChain(locked_chain); | ||||
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.m_confirm.hashBlock.GetHex()); | ||||
entry.pushKV("blockindex", wtx.nIndex); | entry.pushKV("blockindex", wtx.m_confirm.nIndex); | ||||
int64_t block_time; | int64_t block_time; | ||||
bool found_block = | bool found_block = chain.findBlock(wtx.m_confirm.hashBlock, | ||||
chain.findBlock(wtx.hashBlock, nullptr /* block */, &block_time); | nullptr /* block */, &block_time); | ||||
assert(found_block); | assert(found_block); | ||||
entry.pushKV("blocktime", block_time); | entry.pushKV("blocktime", block_time); | ||||
} else { | } else { | ||||
entry.pushKV("trusted", wtx.IsTrusted(locked_chain)); | entry.pushKV("trusted", wtx.IsTrusted(locked_chain)); | ||||
} | } | ||||
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); | ||||
▲ Show 20 Lines • Show All 4,580 Lines • Show Last 20 Lines |