aboutsummaryrefslogtreecommitdiff
path: root/src/rest.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-05-11 16:33:41 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-05-11 16:40:58 +0200
commit7e0e7f823f87e93cc6b2de9779961dc2a5119472 (patch)
tree305eec8c56950b2c63b5557550f92ac09cc6961a /src/rest.cpp
parentc1409d11ad30ff6da37d8bcabe374d42edacb41d (diff)
parent03c56872b532d111645f83f4cb80c36a3e46d54f (diff)
downloadbitcoin-7e0e7f823f87e93cc6b2de9779961dc2a5119472.tar.xz
Merge pull request #6058
03c5687 appropriate response when trying to get a block in pruned mode (Jonas Schnelli) 1b2e555 add autoprune information to RPC "getblockchaininfo" (Jonas Schnelli)
Diffstat (limited to 'src/rest.cpp')
-rw-r--r--src/rest.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rest.cpp b/src/rest.cpp
index 78139682a6..1b7954bbf6 100644
--- a/src/rest.cpp
+++ b/src/rest.cpp
@@ -197,6 +197,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");
}