Sync only after adding a block

This commit is contained in:
nicksavers 2014-08-06 01:02:57 +02:00
parent 6f3fc15b8a
commit 7f44fb49a2
1 changed files with 2 additions and 5 deletions

View File

@ -113,6 +113,7 @@ public class Repository {
public void saveBlock(Block block) {
this.chainDB.put(ByteUtil.longToBytes(block.getNumber()), block.getEncoded());
this.worldState.sync();
}
public Blockchain loadBlockchain() {
@ -148,6 +149,7 @@ public class Repository {
}
// Update world state to latest loaded block from db
this.worldState.setRoot(blockchain.getLastBlock().getStateRoot());
return blockchain;
}
@ -422,11 +424,6 @@ public class Repository {
}
public void close() {
if (worldState != null){
worldState.sync();
}
if (this.chainDB != null)
chainDB.close();
if (this.stateDB != null)