diff --git a/ethereumj-core/src/main/java/org/ethereum/core/Blockchain.java b/ethereumj-core/src/main/java/org/ethereum/core/Blockchain.java index e85fb122..666cdd35 100644 --- a/ethereumj-core/src/main/java/org/ethereum/core/Blockchain.java +++ b/ethereumj-core/src/main/java/org/ethereum/core/Blockchain.java @@ -172,7 +172,10 @@ public class Blockchain { logger.debug("Displaying blocks stored in DB sorted on blocknumber"); byte[] parentHash = Genesis.PARENT_HASH; // get Genesis block by parentHash for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) { - this.addBlock(new Block(db.get(parentHash))); + byte[] parentRLP = db.get(parentHash); + if (parentRLP == null) return; + + this.addBlock(new Block(parentRLP)); if (logger.isDebugEnabled()) logger.debug("Block: " + getLastBlock().getNumber() + " ---> " + getLastBlock().toFlatString()); parentHash = getLastBlock().getHash(); diff --git a/ethereumj-core/src/main/java/org/ethereum/core/Wallet.java b/ethereumj-core/src/main/java/org/ethereum/core/Wallet.java index ab5261fd..77dff4d1 100644 --- a/ethereumj-core/src/main/java/org/ethereum/core/Wallet.java +++ b/ethereumj-core/src/main/java/org/ethereum/core/Wallet.java @@ -105,8 +105,9 @@ public class Wallet { public void processBlock(Block block){ - // todo: proceed coinbase when you are the miner that gets an award + if (block == null) return; + // todo: proceed coinbase when you are the miner that gets an award boolean walletUpdated = false; List transactions = block.getTransactionsList();