Search in sources :

Example 1 with ProposalPayload

use of org.hyperledger.besu.consensus.ibft.payload.ProposalPayload in project besu by hyperledger.

the class RoundChangePayloadValidator method validatePrepareCertificate.

private boolean validatePrepareCertificate(final PreparedCertificate certificate, final ConsensusRoundIdentifier roundChangeTarget) {
    final SignedData<ProposalPayload> proposalMessage = certificate.getProposalPayload();
    final ConsensusRoundIdentifier proposalRoundIdentifier = proposalMessage.getPayload().getRoundIdentifier();
    if (!validatePreparedCertificateRound(proposalRoundIdentifier, roundChangeTarget)) {
        return false;
    }
    final SignedDataValidator signedDataValidator = messageValidatorFactory.createAt(proposalRoundIdentifier);
    return validateConsistencyOfPrepareCertificateMessages(certificate, signedDataValidator);
}
Also used : ConsensusRoundIdentifier(org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier) ProposalPayload(org.hyperledger.besu.consensus.ibft.payload.ProposalPayload)

Example 2 with ProposalPayload

use of org.hyperledger.besu.consensus.ibft.payload.ProposalPayload in project besu by hyperledger.

the class SignedDataValidator method handleSubsequentProposal.

private boolean handleSubsequentProposal(final SignedData<ProposalPayload> existingMsg, final SignedData<ProposalPayload> newMsg) {
    if (!existingMsg.getAuthor().equals(newMsg.getAuthor())) {
        LOG.info("Received subsequent invalid Proposal message; sender differs from original.");
        return false;
    }
    final ProposalPayload existingData = existingMsg.getPayload();
    final ProposalPayload newData = newMsg.getPayload();
    if (!proposalMessagesAreIdentical(existingData, newData)) {
        LOG.info("Received subsequent invalid Proposal message; content differs from original.");
        return false;
    }
    return true;
}
Also used : ProposalPayload(org.hyperledger.besu.consensus.ibft.payload.ProposalPayload)

Example 3 with ProposalPayload

use of org.hyperledger.besu.consensus.ibft.payload.ProposalPayload in project besu by hyperledger.

the class Proposal method decode.

public static Proposal decode(final Bytes data) {
    final RLPInput rlpIn = RLP.input(data);
    rlpIn.enterList();
    final SignedData<ProposalPayload> payload = PayloadDeserializers.readSignedProposalPayloadFrom(rlpIn);
    final Block proposedBlock = Block.readFrom(rlpIn, BftBlockHeaderFunctions.forCommittedSeal(BFT_EXTRA_DATA_ENCODER));
    final Optional<RoundChangeCertificate> roundChangeCertificate = readRoundChangeCertificate(rlpIn);
    rlpIn.leaveList();
    return new Proposal(payload, proposedBlock, roundChangeCertificate);
}
Also used : RLPInput(org.hyperledger.besu.ethereum.rlp.RLPInput) RoundChangeCertificate(org.hyperledger.besu.consensus.ibft.payload.RoundChangeCertificate) ProposalPayload(org.hyperledger.besu.consensus.ibft.payload.ProposalPayload) Block(org.hyperledger.besu.ethereum.core.Block)

Aggregations

ProposalPayload (org.hyperledger.besu.consensus.ibft.payload.ProposalPayload)3 ConsensusRoundIdentifier (org.hyperledger.besu.consensus.common.bft.ConsensusRoundIdentifier)1 RoundChangeCertificate (org.hyperledger.besu.consensus.ibft.payload.RoundChangeCertificate)1 Block (org.hyperledger.besu.ethereum.core.Block)1 RLPInput (org.hyperledger.besu.ethereum.rlp.RLPInput)1