aboutsummaryrefslogtreecommitdiff
path: root/src/rpcblockchain.cpp
diff options
context:
space:
mode:
authorJonas Schnelli <jonas.schnelli@include7.ch>2015-04-27 05:18:24 +0200
committerJonas Schnelli <jonas.schnelli@include7.ch>2015-05-11 16:10:08 +0200
commit03c56872b532d111645f83f4cb80c36a3e46d54f (patch)
tree5767fb219a14e6f058e8a7c996a72d6b8f2a3428 /src/rpcblockchain.cpp
parent1b2e555593ed2fade74657355e13fbad2f0b552c (diff)
appropriate response when trying to get a block in pruned mode
Diffstat (limited to 'src/rpcblockchain.cpp')
-rw-r--r--src/rpcblockchain.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp
index d8771d1dd5..126e201528 100644
--- a/src/rpcblockchain.cpp
+++ b/src/rpcblockchain.cpp
@@ -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");