Option to run besu after blocks import (#1043)

Add an option to run besu after blocks import.  This is aimed to cut the
startup penalty in half for hive testing, combining the block import
with the node execution.

Signed-off-by: Danno Ferrin <danno.ferrin@gmail.com>
pull/1049/head
Danno Ferrin 5 years ago committed by GitHub
parent 3c2ef2b1e6
commit 83d92bbcba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      besu/src/main/java/org/hyperledger/besu/cli/subcommands/blocks/BlocksSubCommand.java
  2. 3
      besu/src/test/java/org/hyperledger/besu/cli/subcommands/blocks/BlocksSubCommandTest.java

@ -152,6 +152,9 @@ public class BlocksSubCommand implements Runnable {
description = "Skip proof of work validation when importing.")
private final Boolean skipPow = false;
@Option(names = "--run", description = "Start besu after importing.")
private final Boolean runBesu = false;
@SuppressWarnings("unused")
@Spec
private CommandSpec spec;
@ -197,6 +200,10 @@ public class BlocksSubCommand implements Runnable {
}
}
}
if (runBesu) {
parentCommand.parentCommand.run();
}
} finally {
metricsService.ifPresent(MetricsService::stop);
}

@ -57,7 +57,7 @@ public class BlocksSubCommandTest extends CommandTestAbstract {
+ System.lineSeparator();
private static final String EXPECTED_BLOCK_IMPORT_USAGE =
"Usage: besu blocks import [-hV] [--skip-pow-validation-enabled]\n"
"Usage: besu blocks import [-hV] [--run] [--skip-pow-validation-enabled]\n"
+ " [--format=<format>] [--start-time=<startTime>] [--from\n"
+ " [=<FILE>...]]... [<FILE>...]\n"
+ "This command imports blocks from a file into the database.\n"
@ -66,6 +66,7 @@ public class BlocksSubCommandTest extends CommandTestAbstract {
+ " are: RLP, JSON (default: RLP).\n"
+ " --from[=<FILE>...] File containing blocks to import.\n"
+ " -h, --help Show this help message and exit.\n"
+ " --run Start besu after importing.\n"
+ " --skip-pow-validation-enabled\n"
+ " Skip proof of work validation when importing.\n"
+ " --start-time=<startTime>\n"

Loading…
Cancel
Save