use of org.hyperledger.besu.crypto.NodeKey in project besu by hyperledger.
the class SpuriousBehaviourTest method nonValidatorsCannotTriggerResponses.
@Test
public void nonValidatorsCannotTriggerResponses() {
final NodeKey nonValidatorNodeKey = NodeKeyUtils.generate();
final NodeParams nonValidatorParams = new NodeParams(Util.publicKeyToAddress(nonValidatorNodeKey.getPublicKey()), nonValidatorNodeKey);
final ValidatorPeer nonvalidator = new ValidatorPeer(nonValidatorParams, new MessageFactory(nonValidatorParams.getNodeKey()), context.getEventMultiplexer());
nonvalidator.injectProposal(new ConsensusRoundIdentifier(1, 0), proposedBlock);
peers.verifyNoMessagesReceived();
}
use of org.hyperledger.besu.crypto.NodeKey in project besu by hyperledger.
the class PublicKeySubCommandTest method callingPublicKeyExportAddressSubCommandWithoutPathMustWriteAddressToStandardOutput.
@Test
public void callingPublicKeyExportAddressSubCommandWithoutPathMustWriteAddressToStandardOutput() {
final NodeKey nodeKey = getNodeKey();
parseCommand(PUBLIC_KEY_SUBCOMMAND_NAME, PUBLIC_KEY_EXPORT_ADDRESS_SUBCOMMAND_NAME);
final String expectedOutputStart = Util.publicKeyToAddress(nodeKey.getPublicKey()).toString();
assertThat(commandOutput.toString(UTF_8)).startsWith(expectedOutputStart);
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
use of org.hyperledger.besu.crypto.NodeKey in project besu by hyperledger.
the class PublicKeySubCommandTest method callingPublicKeyExportAddressSubCommandWithFilePathMustWriteAddressInThisFile.
@Test
public void callingPublicKeyExportAddressSubCommandWithFilePathMustWriteAddressInThisFile() throws Exception {
final NodeKey nodeKey = getNodeKey();
final File file = File.createTempFile("public", "address");
parseCommand(PUBLIC_KEY_SUBCOMMAND_NAME, PUBLIC_KEY_EXPORT_ADDRESS_SUBCOMMAND_NAME, "--to", file.getPath());
assertThat(contentOf(file)).startsWith(Util.publicKeyToAddress(nodeKey.getPublicKey()).toString()).endsWith(Util.publicKeyToAddress(nodeKey.getPublicKey()).toString());
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
use of org.hyperledger.besu.crypto.NodeKey in project besu by hyperledger.
the class PublicKeySubCommandTest method callingPublicKeyExportSubCommandWithoutPathMustWriteKeyToStandardOutput.
@Test
public void callingPublicKeyExportSubCommandWithoutPathMustWriteKeyToStandardOutput() {
final NodeKey nodeKey = getNodeKey();
parseCommand(PUBLIC_KEY_SUBCOMMAND_NAME, PUBLIC_KEY_EXPORT_SUBCOMMAND_NAME);
final String expectedOutputStart = nodeKey.getPublicKey().toString();
assertThat(commandOutput.toString(UTF_8)).startsWith(expectedOutputStart);
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
use of org.hyperledger.besu.crypto.NodeKey in project besu by hyperledger.
the class PublicKeySubCommandTest method callingPublicKeyExportSubCommandWithFilePathMustWritePublicKeyInThisFile.
@Test
public void callingPublicKeyExportSubCommandWithFilePathMustWritePublicKeyInThisFile() throws Exception {
final NodeKey nodeKey = getNodeKey();
final File file = File.createTempFile("public", "key");
parseCommand(PUBLIC_KEY_SUBCOMMAND_NAME, PUBLIC_KEY_EXPORT_SUBCOMMAND_NAME, "--to", file.getPath());
assertThat(contentOf(file)).startsWith(nodeKey.getPublicKey().toString()).endsWith(nodeKey.getPublicKey().toString());
assertThat(commandOutput.toString(UTF_8)).isEmpty();
assertThat(commandErrorOutput.toString(UTF_8)).isEmpty();
}
Aggregations