Call InvalidateBlock without cs_main held

This commit is contained in:
Pieter Wuille
2019-02-13 15:53:24 -08:00
parent 241b2c74ac
commit 9b1ff5c742
3 changed files with 6 additions and 6 deletions

View File

@@ -1583,15 +1583,15 @@ static UniValue invalidateblock(const JSONRPCRequest& request)
uint256 hash(ParseHashV(request.params[0], "blockhash"));
CValidationState state;
CBlockIndex* pblockindex;
{
LOCK(cs_main);
CBlockIndex* pblockindex = LookupBlockIndex(hash);
pblockindex = LookupBlockIndex(hash);
if (!pblockindex) {
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
}
InvalidateBlock(state, Params(), pblockindex);
}
InvalidateBlock(state, Params(), pblockindex);
if (state.IsValid()) {
ActivateBestChain(state, Params());