From 3dbae2d32149938f9d68e75518bb0b1067b4559f Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Tue, 10 May 2016 12:43:19 +0200 Subject: [PATCH] Merge #8019: Remove state arg from ReconsiderBlock, rename to ResetBlockFailureFlags 657e07e Rename ReconsiderBlock func to reflect real behavior (instagibbs) addb9d2 Remove state arg from ReconsiderBlock (instagibbs) --- src/rpc/blockchain.cpp | 8 +++----- src/validation.cpp | 7 +++---- src/validation.h | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index f9e9e22d6..94abf9bb6 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -1131,7 +1131,6 @@ UniValue reconsiderblock(const UniValue& params, bool fHelp) std::string strHash = params[0].get_str(); uint256 hash(uint256S(strHash)); - CValidationState state; { LOCK(cs_main); @@ -1139,12 +1138,11 @@ UniValue reconsiderblock(const UniValue& params, bool fHelp) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; - ReconsiderBlock(state, pblockindex); + ResetBlockFailureFlags(pblockindex); } - if (state.IsValid()) { - ActivateBestChain(state, Params(), NULL); - } + CValidationState state; + ActivateBestChain(state, Params(), NULL); if (!state.IsValid()) { throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); diff --git a/src/validation.cpp b/src/validation.cpp index 75735ca52..946f0290a 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -2619,10 +2619,9 @@ void ReprocessBlocks(int nBlocks) if (mi != mapBlockIndex.end() && (*mi).second) { CBlockIndex* pindex = (*mi).second; - LogPrintf("ReprocessBlocks -- %s\n", (*it).first.ToString()); + LogPrintf("ResetBlockFailureFlags -- %s\n", (*it).first.ToString()); - CValidationState state; - ReconsiderBlock(state, pindex); + ResetBlockFailureFlags(pindex); } } ++it; @@ -2902,7 +2901,7 @@ bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, C return true; } -bool ReconsiderBlock(CValidationState& state, CBlockIndex *pindex) { +bool ResetBlockFailureFlags(CBlockIndex *pindex) { AssertLockHeld(cs_main); int nHeight = pindex->nHeight; diff --git a/src/validation.h b/src/validation.h index e9e3ea32e..e5a5c6ebb 100644 --- a/src/validation.h +++ b/src/validation.h @@ -482,7 +482,7 @@ CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& loc bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex); /** Remove invalidity status from a block and its descendants. */ -bool ReconsiderBlock(CValidationState& state, CBlockIndex *pindex); +bool ResetBlockFailureFlags(CBlockIndex *pindex); /** The currently-connected chain of blocks (protected by cs_main). */ extern CChain chainActive;