Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit 3ac370b

Browse files
committed
Abort PruneManager flow if fail to fetch chainBlock
1 parent ab04b08 commit 3ac370b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ethereumj-core/src/main/java/org/ethereum/db/PruneManager.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ public void blockCommitted(BlockHeader block) {
8989
List<Block> pruneBlocks = blockStore.getBlocksByNumber(forkBlockNum);
9090
Block chainBlock = blockStore.getChainBlockByNumber(forkBlockNum);
9191

92+
// reset segment and return
93+
// if chainBlock is accidentally null
94+
if (chainBlock == null) {
95+
segment = null;
96+
return;
97+
}
98+
9299
if (segment == null) {
93100
if (pruneBlocks.size() == 1) // wait for a single chain
94101
segment = new Segment(chainBlock);

0 commit comments

Comments
 (0)