Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/rawtransaction.cpp
Show First 20 Lines • Show All 337 Lines • ▼ Show 20 Lines | return RPCHelpMan{ | ||||
BlockHash(ParseHashV(request.params[1], "blockhash")); | BlockHash(ParseHashV(request.params[1], "blockhash")); | ||||
pblockindex = chainman.m_blockman.LookupBlockIndex(hashBlock); | pblockindex = chainman.m_blockman.LookupBlockIndex(hashBlock); | ||||
if (!pblockindex) { | if (!pblockindex) { | ||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, | ||||
"Block not found"); | "Block not found"); | ||||
} | } | ||||
} else { | } else { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
CChainState &active_chainstate = chainman.ActiveChainstate(); | |||||
// Loop through txids and try to find which block they're in. | // Loop through txids and try to find which block they're in. | ||||
// Exit loop once a block is found. | // Exit loop once a block is found. | ||||
for (const auto &txid : setTxIds) { | for (const auto &txid : setTxIds) { | ||||
const Coin &coin = AccessByTxid( | const Coin &coin = | ||||
chainman.ActiveChainstate().CoinsTip(), txid); | AccessByTxid(active_chainstate.CoinsTip(), txid); | ||||
if (!coin.IsSpent()) { | if (!coin.IsSpent()) { | ||||
pblockindex = chainman.ActiveChain()[coin.GetHeight()]; | pblockindex = | ||||
active_chainstate.m_chain[coin.GetHeight()]; | |||||
break; | break; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
// Allow txindex to catch up if we need to query it and before we | // Allow txindex to catch up if we need to query it and before we | ||||
// acquire cs_main. | // acquire cs_main. | ||||
if (g_txindex && !pblockindex) { | if (g_txindex && !pblockindex) { | ||||
▲ Show 20 Lines • Show All 1,891 Lines • Show Last 20 Lines |