File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -197,6 +197,9 @@ static bool rest_block(AcceptedConnection* conn,
197
197
throw RESTERR (HTTP_NOT_FOUND, hashStr + " not found" );
198
198
199
199
pblockindex = mapBlockIndex[hash];
200
+ if (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0 )
201
+ throw RESTERR (HTTP_NOT_FOUND, hashStr + " not available (pruned data)" );
202
+
200
203
if (!ReadBlockFromDisk (block, pblockindex))
201
204
throw RESTERR (HTTP_NOT_FOUND, hashStr + " not found" );
202
205
}
Original file line number Diff line number Diff line change @@ -299,6 +299,9 @@ Value getblock(const Array& params, bool fHelp)
299
299
CBlock block;
300
300
CBlockIndex* pblockindex = mapBlockIndex[hash];
301
301
302
+ if (fHavePruned && !(pblockindex->nStatus & BLOCK_HAVE_DATA) && pblockindex->nTx > 0 )
303
+ throw JSONRPCError (RPC_INTERNAL_ERROR, " Block not available (pruned data)" );
304
+
302
305
if (!ReadBlockFromDisk (block, pblockindex))
303
306
throw JSONRPCError (RPC_INTERNAL_ERROR, " Can't read block from disk" );
304
307
@@ -492,6 +495,15 @@ Value getblockchaininfo(const Array& params, bool fHelp)
492
495
obj.push_back (Pair (" difficulty" , (double )GetDifficulty ()));
493
496
obj.push_back (Pair (" verificationprogress" , Checkpoints::GuessVerificationProgress (Params ().Checkpoints (), chainActive.Tip ())));
494
497
obj.push_back (Pair (" chainwork" , chainActive.Tip ()->nChainWork .GetHex ()));
498
+ obj.push_back (Pair (" pruned" , fPruneMode ));
499
+ if (fPruneMode )
500
+ {
501
+ CBlockIndex *block = chainActive.Tip ();
502
+ while (block && block->pprev && (block->pprev ->nStatus & BLOCK_HAVE_DATA))
503
+ block = block->pprev ;
504
+
505
+ obj.push_back (Pair (" pruneheight" , block->nHeight ));
506
+ }
495
507
return obj;
496
508
}
497
509
You can’t perform that action at this time.
0 commit comments