change max block decrement amount to 50

This commit is contained in:
Kay Kurokawa 2017-01-04 17:52:07 -05:00
parent 6542b53b36
commit 61664b027b

View file

@ -4,6 +4,8 @@
#include "univalue.h" #include "univalue.h"
#include "txmempool.h" #include "txmempool.h"
// Maximum block decrement that is allowed from rpc calls
const int MAX_RPC_BLOCK_DECREMENTS = 50;
UniValue getclaimsintrie(const UniValue& params, bool fHelp) UniValue getclaimsintrie(const UniValue& params, bool fHelp)
{ {
@ -682,7 +684,7 @@ UniValue getnameproof(const UniValue& params, bool fHelp)
if (!chainActive.Contains(pblockIndex)) if (!chainActive.Contains(pblockIndex))
throw JSONRPCError(RPC_INTERNAL_ERROR, "Block not in main chain"); throw JSONRPCError(RPC_INTERNAL_ERROR, "Block not in main chain");
if (chainActive.Tip()->nHeight > (pblockIndex->nHeight + 20)) if (chainActive.Tip()->nHeight > (pblockIndex->nHeight + MAX_RPC_BLOCK_DECREMENTS))
throw JSONRPCError(RPC_INTERNAL_ERROR, "Block too deep to generate proof"); throw JSONRPCError(RPC_INTERNAL_ERROR, "Block too deep to generate proof");
CClaimTrieProof proof; CClaimTrieProof proof;