mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 04:22:55 +01:00
appropriate response when trying to get a block in pruned mode
This commit is contained in:
parent
1b2e555593
commit
03c56872b5
@ -174,6 +174,9 @@ static bool rest_block(AcceptedConnection* conn,
|
||||
throw RESTERR(HTTP_NOT_FOUND, hashStr + " not found");
|
||||
|
||||
pblockindex = mapBlockIndex[hash];
|
||||
if (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0)
|
||||
throw RESTERR(HTTP_NOT_FOUND, hashStr + " not available (pruned data)");
|
||||
|
||||
if (!ReadBlockFromDisk(block, pblockindex))
|
||||
throw RESTERR(HTTP_NOT_FOUND, hashStr + " not found");
|
||||
}
|
||||
|
@ -299,6 +299,9 @@ Value getblock(const Array& params, bool fHelp)
|
||||
CBlock block;
|
||||
CBlockIndex* pblockindex = mapBlockIndex[hash];
|
||||
|
||||
if (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0)
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Block not available (pruned data)");
|
||||
|
||||
if(!ReadBlockFromDisk(block, pblockindex))
|
||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user