BlockChain load NullPointerException resolved
This commit is contained in:
parent
bbcc1d7eac
commit
1e6835f71d
|
@ -172,7 +172,10 @@ public class Blockchain {
|
||||||
logger.debug("Displaying blocks stored in DB sorted on blocknumber");
|
logger.debug("Displaying blocks stored in DB sorted on blocknumber");
|
||||||
byte[] parentHash = Genesis.PARENT_HASH; // get Genesis block by parentHash
|
byte[] parentHash = Genesis.PARENT_HASH; // get Genesis block by parentHash
|
||||||
for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) {
|
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())
|
if (logger.isDebugEnabled())
|
||||||
logger.debug("Block: " + getLastBlock().getNumber() + " ---> " + getLastBlock().toFlatString());
|
logger.debug("Block: " + getLastBlock().getNumber() + " ---> " + getLastBlock().toFlatString());
|
||||||
parentHash = getLastBlock().getHash();
|
parentHash = getLastBlock().getHash();
|
||||||
|
|
|
@ -105,8 +105,9 @@ public class Wallet {
|
||||||
|
|
||||||
public void processBlock(Block block){
|
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;
|
boolean walletUpdated = false;
|
||||||
|
|
||||||
List<Transaction> transactions = block.getTransactionsList();
|
List<Transaction> transactions = block.getTransactionsList();
|
||||||
|
|
Loading…
Reference in New Issue