Changeset View
Changeset View
Standalone View
Standalone View
src/wallet/rpcwallet.cpp
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | void WalletTxToJSON(const CWalletTx &wtx, UniValue &entry) { | ||||
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); | ||||
entry.pushKV("blocktime", mapBlockIndex[wtx.hashBlock]->GetBlockTime()); | entry.pushKV("blocktime", | ||||
LookupBlockIndex(wtx.hashBlock)->GetBlockTime()); | |||||
} else { | } else { | ||||
entry.pushKV("trusted", wtx.IsTrusted()); | 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()); | ||||
▲ Show 20 Lines • Show All 2,110 Lines • ▼ Show 20 Lines | static UniValue listsinceblock(const Config &config, | ||||
const CBlockIndex *paltindex = nullptr; | const CBlockIndex *paltindex = nullptr; | ||||
int target_confirms = 1; | int target_confirms = 1; | ||||
isminefilter filter = ISMINE_SPENDABLE; | isminefilter filter = ISMINE_SPENDABLE; | ||||
if (!request.params[0].isNull() && !request.params[0].get_str().empty()) { | if (!request.params[0].isNull() && !request.params[0].get_str().empty()) { | ||||
uint256 blockId; | uint256 blockId; | ||||
blockId.SetHex(request.params[0].get_str()); | blockId.SetHex(request.params[0].get_str()); | ||||
BlockMap::iterator it = mapBlockIndex.find(blockId); | paltindex = pindex = LookupBlockIndex(blockId); | ||||
if (it == mapBlockIndex.end()) { | if (!pindex) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); | ||||
} | } | ||||
paltindex = pindex = it->second; | |||||
if (chainActive[pindex->nHeight] != pindex) { | if (chainActive[pindex->nHeight] != pindex) { | ||||
// the block being asked for is a part of a deactivated chain; | // the block being asked for is a part of a deactivated chain; | ||||
// we don't want to depend on its perceived height in the block | // we don't want to depend on its perceived height in the block | ||||
// chain, we want to instead use the last common ancestor | // chain, we want to instead use the last common ancestor | ||||
pindex = chainActive.FindFork(pindex); | pindex = chainActive.FindFork(pindex); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,708 Lines • Show Last 20 Lines |