mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-01 03:16:09 +02:00
Add LookupBlockIndex function
This commit is contained in:
@@ -95,7 +95,7 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry)
|
||||
{
|
||||
entry.pushKV("blockhash", wtx.hashBlock.GetHex());
|
||||
entry.pushKV("blockindex", wtx.nIndex);
|
||||
entry.pushKV("blocktime", mapBlockIndex[wtx.hashBlock]->GetBlockTime());
|
||||
entry.pushKV("blocktime", LookupBlockIndex(wtx.hashBlock)->GetBlockTime());
|
||||
} else {
|
||||
entry.pushKV("trusted", wtx.IsTrusted());
|
||||
}
|
||||
@@ -2014,11 +2014,10 @@ UniValue listsinceblock(const JSONRPCRequest& request)
|
||||
uint256 blockId;
|
||||
|
||||
blockId.SetHex(request.params[0].get_str());
|
||||
BlockMap::iterator it = mapBlockIndex.find(blockId);
|
||||
if (it == mapBlockIndex.end()) {
|
||||
paltindex = pindex = LookupBlockIndex(blockId);
|
||||
if (!pindex) {
|
||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
||||
}
|
||||
paltindex = pindex = it->second;
|
||||
if (chainActive[pindex->nHeight] != pindex) {
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user