Skip to content

Commit

Permalink
fix(sync): proof and proposal_hash hash not match. (nervosnetwork#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
yejiayu authored May 21, 2019
1 parent 12d8d01 commit 51f332e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions core/consensus/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use core_pubsub::{channel::pubsub::Sender, register::Register, PUBSUB_BROADCAST_
use core_runtime::{
ExecutionContext, ExecutionResult, Executor, Storage, StorageError, TransactionPool,
};
use core_serialization::{AsyncCodec, Proposal as SerProposal};
use core_types::{
Address, Block, BlockHeader, Hash, Proof, Proposal, SignedTransaction, TransactionPosition,
};
Expand Down Expand Up @@ -361,7 +360,7 @@ where
));
}

let proposal: SerProposal = Proposal {
let proposal = Proposal {
prevhash: block.header.prevhash.clone(),
timestamp: block.header.timestamp,
height: block.header.height,
Expand All @@ -370,11 +369,8 @@ where
transaction_root: Merkle::from_hashes(block.tx_hashes.clone()).get_root_hash(),
tx_hashes: block.tx_hashes.clone(),
proof: block.header.proof.clone(),
}
.into();
let proposal_bytes = await!(AsyncCodec::encode(proposal))?;
let proposal_hash = Hash::digest(&proposal_bytes);
if proof.proposal_hash != proposal_hash {
};
if proof.proposal_hash != proposal.hash() {
return Err(ConsensusError::Internal(
"proof and proposal_hash hash not match".to_owned(),
));
Expand Down

0 comments on commit 51f332e

Please sign in to comment.