mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 21:12:48 +01:00
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)
This commit is contained in:
parent
262e857db9
commit
3dbae2d321
@ -1131,7 +1131,6 @@ UniValue reconsiderblock(const UniValue& params, bool fHelp)
|
|||||||
|
|
||||||
std::string strHash = params[0].get_str();
|
std::string strHash = params[0].get_str();
|
||||||
uint256 hash(uint256S(strHash));
|
uint256 hash(uint256S(strHash));
|
||||||
CValidationState state;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
@ -1139,12 +1138,11 @@ UniValue reconsiderblock(const UniValue& params, bool fHelp)
|
|||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
|
||||||
|
|
||||||
CBlockIndex* pblockindex = mapBlockIndex[hash];
|
CBlockIndex* pblockindex = mapBlockIndex[hash];
|
||||||
ReconsiderBlock(state, pblockindex);
|
ResetBlockFailureFlags(pblockindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.IsValid()) {
|
CValidationState state;
|
||||||
ActivateBestChain(state, Params(), NULL);
|
ActivateBestChain(state, Params(), NULL);
|
||||||
}
|
|
||||||
|
|
||||||
if (!state.IsValid()) {
|
if (!state.IsValid()) {
|
||||||
throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason());
|
throw JSONRPCError(RPC_DATABASE_ERROR, state.GetRejectReason());
|
||||||
|
@ -2619,10 +2619,9 @@ void ReprocessBlocks(int nBlocks)
|
|||||||
if (mi != mapBlockIndex.end() && (*mi).second) {
|
if (mi != mapBlockIndex.end() && (*mi).second) {
|
||||||
|
|
||||||
CBlockIndex* pindex = (*mi).second;
|
CBlockIndex* pindex = (*mi).second;
|
||||||
LogPrintf("ReprocessBlocks -- %s\n", (*it).first.ToString());
|
LogPrintf("ResetBlockFailureFlags -- %s\n", (*it).first.ToString());
|
||||||
|
|
||||||
CValidationState state;
|
ResetBlockFailureFlags(pindex);
|
||||||
ReconsiderBlock(state, pindex);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
++it;
|
++it;
|
||||||
@ -2902,7 +2901,7 @@ bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, C
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReconsiderBlock(CValidationState& state, CBlockIndex *pindex) {
|
bool ResetBlockFailureFlags(CBlockIndex *pindex) {
|
||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
|
|
||||||
int nHeight = pindex->nHeight;
|
int nHeight = pindex->nHeight;
|
||||||
|
@ -482,7 +482,7 @@ CBlockIndex* FindForkInGlobalIndex(const CChain& chain, const CBlockLocator& loc
|
|||||||
bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex);
|
bool InvalidateBlock(CValidationState& state, const CChainParams& chainparams, CBlockIndex *pindex);
|
||||||
|
|
||||||
/** Remove invalidity status from a block and its descendants. */
|
/** 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). */
|
/** The currently-connected chain of blocks (protected by cs_main). */
|
||||||
extern CChain chainActive;
|
extern CChain chainActive;
|
||||||
|
Loading…
Reference in New Issue
Block a user