mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-29 09:55:49 +02:00
scripted-diff: Use BlockManager::LookupBlockIndex
[META] In a previous commit, we moved ::LookupBlockIndex to become a
member function of BlockManager. This commit is split out from
that one since it can be expressed nicely as a scripted-diff.
-BEGIN VERIFY SCRIPT-
find_regex='LookupBlockIndex' \
&& git grep -l -E "$find_regex" -- src \
| grep -v '^src/validation\.\(cpp\|h\)$' \
| xargs sed -i -E "s@${find_regex}@g_chainman.m_blockman.LookupBlockIndex@g"
-END VERIFY SCRIPT-
This commit is contained in:
@@ -375,7 +375,7 @@ static RPCHelpMan generateblock()
|
||||
LOCK(cs_main);
|
||||
|
||||
BlockValidationState state;
|
||||
if (!TestBlockValidity(state, chainparams, block, LookupBlockIndex(block.hashPrevBlock), false, false)) {
|
||||
if (!TestBlockValidity(state, chainparams, block, g_chainman.m_blockman.LookupBlockIndex(block.hashPrevBlock), false, false)) {
|
||||
throw JSONRPCError(RPC_VERIFY_ERROR, strprintf("TestBlockValidity failed: %s", state.ToString()));
|
||||
}
|
||||
}
|
||||
@@ -618,7 +618,7 @@ static RPCHelpMan getblocktemplate()
|
||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
||||
|
||||
uint256 hash = block.GetHash();
|
||||
const CBlockIndex* pindex = LookupBlockIndex(hash);
|
||||
const CBlockIndex* pindex = g_chainman.m_blockman.LookupBlockIndex(hash);
|
||||
if (pindex) {
|
||||
if (pindex->IsValid(BLOCK_VALID_SCRIPTS))
|
||||
return "duplicate";
|
||||
@@ -966,7 +966,7 @@ static RPCHelpMan submitblock()
|
||||
uint256 hash = block.GetHash();
|
||||
{
|
||||
LOCK(cs_main);
|
||||
const CBlockIndex* pindex = LookupBlockIndex(hash);
|
||||
const CBlockIndex* pindex = g_chainman.m_blockman.LookupBlockIndex(hash);
|
||||
if (pindex) {
|
||||
if (pindex->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||
return "duplicate";
|
||||
@@ -979,7 +979,7 @@ static RPCHelpMan submitblock()
|
||||
|
||||
{
|
||||
LOCK(cs_main);
|
||||
const CBlockIndex* pindex = LookupBlockIndex(block.hashPrevBlock);
|
||||
const CBlockIndex* pindex = g_chainman.m_blockman.LookupBlockIndex(block.hashPrevBlock);
|
||||
if (pindex) {
|
||||
UpdateUncommittedBlockStructures(block, pindex, Params().GetConsensus());
|
||||
}
|
||||
@@ -1023,7 +1023,7 @@ static RPCHelpMan submitheader()
|
||||
}
|
||||
{
|
||||
LOCK(cs_main);
|
||||
if (!LookupBlockIndex(h.hashPrevBlock)) {
|
||||
if (!g_chainman.m_blockman.LookupBlockIndex(h.hashPrevBlock)) {
|
||||
throw JSONRPCError(RPC_VERIFY_ERROR, "Must submit previous header (" + h.hashPrevBlock.GetHex() + ") first");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user