| 2130 | } |
| 2131 | |
| 2132 | static RPCHelpMan reconsiderblock() |
| 2133 | { |
| 2134 | return RPCHelpMan{"reconsiderblock", |
| 2135 | "\nRemoves invalidity status of a block, its ancestors and its descendants, reconsider them for activation.\n" |
| 2136 | "This can be used to undo the effects of invalidateblock.\n", |
| 2137 | { |
| 2138 | {"blockhash", RPCArg::Type::STR_HEX, RPCArg::Optional::NO, "the hash of the block to reconsider"}, |
| 2139 | }, |
| 2140 | RPCResult{RPCResult::Type::NONE, "", ""}, |
| 2141 | RPCExamples{ |
| 2142 | HelpExampleCli("reconsiderblock", "\"blockhash\"") |
| 2143 | + HelpExampleRpc("reconsiderblock", "\"blockhash\"") |
| 2144 | }, |
| 2145 | [&](const RPCHelpMan& self, const JSONRPCRequest& request) -> UniValue |
| 2146 | { |
| 2147 | ChainstateManager& chainman = EnsureAnyChainman(request.context); |
| 2148 | uint256 hash(ParseHashV(request.params[0], "blockhash")); |
| 2149 | |
| 2150 | { |
| 2151 | LOCK(cs_main); |
| 2152 | CBlockIndex* pblockindex = chainman.m_blockman.LookupBlockIndex(hash); |
| 2153 | if (!pblockindex) { |
| 2154 | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); |
| 2155 | } |
| 2156 | |
| 2157 | chainman.ActiveChainstate().ResetBlockFailureFlags(pblockindex); |
| 2158 | } |
| 2159 | |
| 2160 | BlockValidationState state; |
| 2161 | chainman.ActiveChainstate().ActivateBestChain(state); |
| 2162 | |
| 2163 | if (!state.IsValid()) { |
| 2164 | throw JSONRPCError(RPC_DATABASE_ERROR, state.ToString()); |
| 2165 | } |
| 2166 | |
| 2167 | return NullUniValue; |
| 2168 | }, |
| 2169 | }; |
| 2170 | } |
| 2171 | |
| 2172 | static RPCHelpMan getchaintxstats() |
| 2173 | { |
nothing calls this directly
no test coverage detected