mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
consensus: ignore proposals with transactions exceeding cap
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
|
||||
Reference in New Issue
Block a user