consensus: ignore proposals with transactions exceeding cap

This commit is contained in:
aggstam
2022-12-06 22:34:38 +02:00
parent 8f7ae3f6e9
commit 1bfef5dce3
2 changed files with 14 additions and 1 deletions

View File

@@ -375,6 +375,16 @@ impl ValidatorState {
return Err(Error::ExtendedChainIndexNotFound)
}
// Check that proposal transactions don't exceed limit
if proposal.block.txs.len() > constants::TXS_CAP {
warn!(
"receive_proposal(): Received proposal transactions exceed configured cap: {} - {}",
proposal.block.txs.len(),
constants::TXS_CAP
);
return Err(Error::ProposalTxsExceedCapError)
}
// Verify proposal signature is valid based on producer public key
// TODO: derive public key from proof
if !lf.public_key.verify(proposal.header.as_bytes(), &lf.signature) {

View File

@@ -256,9 +256,12 @@ pub enum Error {
#[error("Proposal contains different coin creation eta")]
ProposalDifferentCoinEtaError,
#[error("proposed coin is spent")]
#[error("Proposal contains spent coin")]
ProposalIsSpent,
#[error("Proposal contains more transactions than configured cap")]
ProposalTxsExceedCapError,
#[error("unable to verify transfer transaction")]
TransferTxVerification,