mirror of
https://github.com/status-im/ethereumj-personal.git
synced 2025-01-26 20:01:02 +00:00
Sync only after adding a block
This commit is contained in:
parent
6f3fc15b8a
commit
7f44fb49a2
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user