From addb9d2a092b4fd0384d4ff82e9607e5411eab97 Mon Sep 17 00:00:00 2001 From: instagibbs Date: Fri, 6 May 2016 12:53:23 -0400 Subject: Remove state arg from ReconsiderBlock --- src/main.cpp | 2 +- src/main.h | 2 +- src/rpc/blockchain.cpp | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 92a38f230f..9489bb1c46 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3011,7 +3011,7 @@ bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, C return true; } -bool ReconsiderBlock(CValidationState& state, CBlockIndex *pindex) { +bool ReconsiderBlock(CBlockIndex *pindex) { AssertLockHeld(cs_main); int nHeight = pindex->nHeight; diff --git a/src/main.h b/src/main.h index bdf7f5a687..e48cebecb3 100644 --- a/src/main.h +++ b/src/main.h @@ -464,7 +464,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 ReconsiderBlock(CBlockIndex *pindex); /** The currently-connected chain of blocks (protected by cs_main). */ extern CChain chainActive; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 6960415e2e..d221012afa 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -973,7 +973,6 @@ UniValue reconsiderblock(const UniValue& params, bool fHelp) std::string strHash = params[0].get_str(); uint256 hash(uint256S(strHash)); - CValidationState state; { LOCK(cs_main); @@ -981,12 +980,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); + ReconsiderBlock(pblockindex); } - if (state.IsValid()) { - ActivateBestChain(state, Params()); - } + CValidationState state; + ActivateBestChain(state, Params()); if (!state.IsValid()) { throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason()); -- cgit v1.2.3 From 657e07efa34ffe9d8614a618e00452c9ee7c0e0d Mon Sep 17 00:00:00 2001 From: instagibbs Date: Mon, 9 May 2016 11:26:37 -0400 Subject: Rename ReconsiderBlock func to reflect real behavior --- src/main.cpp | 2 +- src/main.h | 2 +- src/rpc/blockchain.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 9489bb1c46..11eaa055d7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3011,7 +3011,7 @@ bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, C return true; } -bool ReconsiderBlock(CBlockIndex *pindex) { +bool ResetBlockFailureFlags(CBlockIndex *pindex) { AssertLockHeld(cs_main); int nHeight = pindex->nHeight; diff --git a/src/main.h b/src/main.h index e48cebecb3..ebbd12c8c3 100644 --- a/src/main.h +++ b/src/main.h @@ -464,7 +464,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(CBlockIndex *pindex); +bool ResetBlockFailureFlags(CBlockIndex *pindex); /** The currently-connected chain of blocks (protected by cs_main). */ extern CChain chainActive; diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index d221012afa..cf3c73c4df 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -980,7 +980,7 @@ UniValue reconsiderblock(const UniValue& params, bool fHelp) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); CBlockIndex* pblockindex = mapBlockIndex[hash]; - ReconsiderBlock(pblockindex); + ResetBlockFailureFlags(pblockindex); } CValidationState state; -- cgit v1.2.3