| 1607 | } |
| 1608 | |
| 1609 | static UniValue reconsiderblock(const JSONRPCRequest& request) |
| 1610 | { |
| 1611 | if (request.fHelp || request.params.size() != 1) |
| 1612 | throw std::runtime_error( |
| 1613 | "reconsiderblock \"blockhash\"\n" |
| 1614 | "\nRemoves invalidity status of a block and its descendants, reconsider them for activation.\n" |
| 1615 | "This can be used to undo the effects of invalidateblock.\n" |
| 1616 | "\nArguments:\n" |
| 1617 | "1. \"blockhash\" (string, required) the hash of the block to reconsider\n" |
| 1618 | "\nResult:\n" |
| 1619 | "\nExamples:\n" |
| 1620 | + HelpExampleCli("reconsiderblock", "\"blockhash\"") |
| 1621 | + HelpExampleRpc("reconsiderblock", "\"blockhash\"") |
| 1622 | ); |
| 1623 | |
| 1624 | std::string strHash = request.params[0].get_str(); |
| 1625 | uint256 hash(uint256S(strHash)); |
| 1626 | |
| 1627 | { |
| 1628 | LOCK(cs_main); |
| 1629 | CBlockIndex* pblockindex = LookupBlockIndex(hash); |
| 1630 | if (!pblockindex) { |
| 1631 | throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found"); |
| 1632 | } |
| 1633 | |
| 1634 | ResetBlockFailureFlags(pblockindex); |
| 1635 | } |
| 1636 | |
| 1637 | CValidationState state; |
| 1638 | ActivateBestChain(state, Params()); |
| 1639 | |
| 1640 | if (!state.IsValid()) { |
| 1641 | throw JSONRPCError(RPC_DATABASE_ERROR, FormatStateMessage(state)); |
| 1642 | } |
| 1643 | |
| 1644 | return NullUniValue; |
| 1645 | } |
| 1646 | |
| 1647 | static UniValue getchaintxstats(const JSONRPCRequest& request) |
| 1648 | { |
nothing calls this directly
no test coverage detected