Sync only after adding a block

This commit is contained in:
nicksavers 2014-08-06 01:02:57 +02:00
parent 6f3fc15b8a
commit 7f44fb49a2

View File

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