Skip to content

Commit

Permalink
Redo-import now prints every imported block and the final execution time
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandraRoatis committed Jul 26, 2019
1 parent 27e821d commit 6dfb187
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modAionImpl/src/org/aion/zero/impl/db/DBUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@ public static void redoMainChainImport(long startHeight) {
CfgAion cfg = CfgAion.inst();
cfg.dbFromXML();
cfg.getConsensus().setMining(false);
cfg.getDb().setHeapCacheEnabled(true);

System.out.println("\nImporting stored blocks INITIATED...\n");

Expand Down Expand Up @@ -617,9 +616,14 @@ public static void redoMainChainImport(long startHeight) {
try {
// clear the index entry and prune side-chain blocks
store.redoIndexWithoutSideChains(block);
long t1 = System.currentTimeMillis();
result =
chain.tryToConnectAndFetchSummary(
block, System.currentTimeMillis() / THOUSAND_MS, false);
long t2 = System.currentTimeMillis();
System.out.println("<import-status: hash = " + block.getShortHash() + ", number = " + block.getNumber()
+ ", txs = " + block.getTransactionsList().size() + ", result = " + result.getLeft()
+ ", time elapsed = " + (t2 - t1) + " ms, td = " + chain.getTotalDifficulty() + ">");
} catch (Throwable t) {
// we want to see the exception and the block where it occurred
t.printStackTrace();
Expand Down Expand Up @@ -692,6 +696,7 @@ public AionBlockSummary getRight() {

currentBlock++;
}
System.out.println("Import from " + startHeight + " to " + topBlockNumber + " completed in " + (System.currentTimeMillis() - start) + " ms time.");
}

if (fail) {
Expand Down

0 comments on commit 6dfb187

Please sign in to comment.