Skip to content

Commit

Permalink
Use batch update in ExtractToDatabase
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandraRoatis committed Apr 14, 2020
1 parent c55cafc commit 7e76b08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modAionImpl/src/org/aion/zero/impl/trie/TrieImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1005,6 +1005,7 @@ private void appendHashes(byte[] bytes, ArrayList<byte[]> hashes) {
public long saveFullStateToDatabase(byte[] stateRoot, ByteArrayKeyValueDatabase db) {
ExtractToDatabase traceAction = new ExtractToDatabase(db);
traceTrie(stateRoot, traceAction);
db.commit();
return traceAction.count;
}

Expand All @@ -1024,6 +1025,7 @@ private void traceDiffTrie(byte[] stateRoot, ScanAction action, ByteArrayKeyValu
public long saveDiffStateToDatabase(byte[] stateRoot, ByteArrayKeyValueDatabase db) {
ExtractToDatabase traceAction = new ExtractToDatabase(db);
traceDiffTrie(stateRoot, traceAction, db);
db.commit();
return traceAction.count;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public ExtractToDatabase(ByteArrayKeyValueDatabase _db) {

@Override
public void doOnNode(byte[] hash, Value node) {
db.put(hash, dummy_value);
db.putToBatch(hash, dummy_value);
count++;
}
}

0 comments on commit 7e76b08

Please sign in to comment.