diff options
| author | Jonas Schnelli <[email protected]> | 2015-04-27 05:18:24 +0200 |
|---|---|---|
| committer | Jonas Schnelli <[email protected]> | 2015-05-11 16:10:08 +0200 |
| commit | 03c56872b532d111645f83f4cb80c36a3e46d54f (patch) | |
| tree | 5767fb219a14e6f058e8a7c996a72d6b8f2a3428 /src/rest.cpp | |
| parent | add autoprune information to RPC "getblockchaininfo" (diff) | |
| download | discoin-03c56872b532d111645f83f4cb80c36a3e46d54f.tar.xz discoin-03c56872b532d111645f83f4cb80c36a3e46d54f.zip | |
appropriate response when trying to get a block in pruned mode
Diffstat (limited to 'src/rest.cpp')
| -rw-r--r-- | src/rest.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rest.cpp b/src/rest.cpp index adc2d5628..69bf5b58a 100644 --- a/src/rest.cpp +++ b/src/rest.cpp @@ -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"); } |