use of org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier in project besu by hyperledger.
the class RoundChangePayloadValidatorTest method roundChangeWithMatchingTargetAndPrepareFails.
@Test
public void roundChangeWithMatchingTargetAndPrepareFails() {
final RoundChangePayload payload = new RoundChangePayload(new ConsensusRoundIdentifier(chainHeight, 1), Optional.of(new PreparedRoundMetadata(preparedBlockHash, 1)));
final SignedData<RoundChangePayload> signedPayload = createSignedPayload(payload, validators.getNode(0).getNodeKey());
assertThat(messageValidator.validate(signedPayload)).isFalse();
}
use of org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier in project besu by hyperledger.
the class RoundChangePayloadValidatorTest method roundChangeForFutureHeightFails.
@Test
public void roundChangeForFutureHeightFails() {
final RoundChangePayload payload = new RoundChangePayload(new ConsensusRoundIdentifier(chainHeight + 1, 1), Optional.of(new PreparedRoundMetadata(preparedBlockHash, 0)));
final SignedData<RoundChangePayload> signedPayload = createSignedPayload(payload, validators.getNode(0).getNodeKey());
assertThat(messageValidator.validate(signedPayload)).isFalse();
}
use of org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier in project besu by hyperledger.
the class RoundChangePayloadValidatorTest method roundChangeWithZeroTargetRoundFails.
@Test
public void roundChangeWithZeroTargetRoundFails() {
final RoundChangePayload payload = new RoundChangePayload(new ConsensusRoundIdentifier(chainHeight, 0), Optional.of(new PreparedRoundMetadata(preparedBlockHash, 0)));
final SignedData<RoundChangePayload> signedPayload = createSignedPayload(payload, validators.getNode(0).getNodeKey());
assertThat(messageValidator.validate(signedPayload)).isFalse();
}
use of org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier in project besu by hyperledger.
the class RoundChangePayloadValidatorTest method roundChangeForPriorHeightFails.
@Test
public void roundChangeForPriorHeightFails() {
final RoundChangePayload payload = new RoundChangePayload(new ConsensusRoundIdentifier(chainHeight - 1, 1), Optional.of(new PreparedRoundMetadata(preparedBlockHash, 0)));
final SignedData<RoundChangePayload> signedPayload = createSignedPayload(payload, validators.getNode(0).getNodeKey());
assertThat(messageValidator.validate(signedPayload)).isFalse();
}
use of org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier in project besu by hyperledger.
the class RoundChangePayloadValidatorTest method roundChangePayloadSignedByNonValidatorFails.
@Test
public void roundChangePayloadSignedByNonValidatorFails() {
final RoundChangePayload payload = new RoundChangePayload(new ConsensusRoundIdentifier(chainHeight, 1), Optional.of(new PreparedRoundMetadata(preparedBlockHash, 0)));
final NodeKey nonValidatorKey = NodeKeyUtils.generate();
final SignedData<RoundChangePayload> signedPayload = createSignedPayload(payload, nonValidatorKey);
assertThat(messageValidator.validate(signedPayload)).isFalse();
}
Aggregations