BlockChain load NullPointerException resolved

This commit is contained in:
romanman 2014-06-15 15:43:37 +01:00
parent bbcc1d7eac
commit 1e6835f71d
2 changed files with 6 additions and 2 deletions

View File

@ -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();

View File

@ -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<Transaction> transactions = block.getTransactionsList();