Skip to content

Commit

Permalink
node: Check Certificate is Success Attestation
Browse files Browse the repository at this point in the history
Resolves #1905
  • Loading branch information
herr-seppia committed Jul 18, 2024
1 parent 8e44945 commit 37f39dc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion node/src/chain/header_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use dusk_consensus::user::committee::{Committee, CommitteeSet};
use dusk_consensus::user::provisioners::{ContextProvisioners, Provisioners};
use execution_core::stake::EPOCH;
use node_data::ledger::{to_str, Fault, InvalidFault, Seed, Signature};
use node_data::message::payload::RatificationResult;
use node_data::message::payload::{RatificationResult, Vote};
use node_data::message::ConsensusHeader;
use node_data::{ledger, StepName};
use std::sync::Arc;
Expand Down Expand Up @@ -173,6 +173,17 @@ impl<'a, DB: database::DB> Validator<'a, DB> {
.map(|h| h.seed)
})?;

let cert_result = candidate_block.prev_block_cert.result;
let prev_block_hash = candidate_block.prev_block_hash;

match candidate_block.prev_block_cert.result {
RatificationResult::Success(Vote::Valid(hash))
if hash == prev_block_hash => {}
_ => anyhow::bail!(
"Invalid result for previous block hash: {cert_result:?}"
),
}

let (_, _, voters) = verify_block_att(
self.prev_header.prev_block_hash,
prev_block_seed,
Expand Down

0 comments on commit 37f39dc

Please sign in to comment.