diff --git a/src/consensus/validator.rs b/src/consensus/validator.rs index ea70001b0..6ed5db788 100644 --- a/src/consensus/validator.rs +++ b/src/consensus/validator.rs @@ -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) { diff --git a/src/error.rs b/src/error.rs index cd9053dbc..064750bea 100644 --- a/src/error.rs +++ b/src/error.rs @@ -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,