diff --git a/consensus/src/proposal/block_generator.rs b/consensus/src/proposal/block_generator.rs index 5ee57eddc..18f258328 100644 --- a/consensus/src/proposal/block_generator.rs +++ b/consensus/src/proposal/block_generator.rs @@ -113,15 +113,15 @@ impl Generator { // We always write the faults len in a u32 let mut faults_size = u32::SIZE; - let faults_hashes: Vec<_> = faults + let fault_digests: Vec<_> = faults .iter() .map(|f| { faults_size += f.size(); - f.hash() + f.digest() }) .collect(); - blk_header.faultroot = merkle_root(&faults_hashes); + blk_header.faultroot = merkle_root(&fault_digests); // We know for sure that this operation cannot underflow let max_txs_bytes = MAX_BLOCK_SIZE - header_size - faults_size; @@ -140,10 +140,10 @@ impl Generator { blk_header.state_hash = result.verification_output.state_root; blk_header.event_bloom = result.verification_output.event_bloom; - let tx_hashes: Vec<_> = - result.txs.iter().map(|t| t.inner.hash()).collect(); + let tx_digests: Vec<_> = + result.txs.iter().map(|t| t.inner.digest()).collect(); let txs: Vec<_> = result.txs.into_iter().map(|t| t.inner).collect(); - blk_header.txroot = merkle_root(&tx_hashes[..]); + blk_header.txroot = merkle_root(&tx_digests[..]); blk_header.timestamp = max( ru.timestamp() + *MINIMUM_BLOCK_TIME, diff --git a/consensus/src/proposal/handler.rs b/consensus/src/proposal/handler.rs index 248aeb2fc..d98d1d70e 100644 --- a/consensus/src/proposal/handler.rs +++ b/consensus/src/proposal/handler.rs @@ -173,9 +173,9 @@ fn verify_candidate_msg( } // Verify tx_root - let tx_hashes: Vec<_> = - p.candidate.txs().iter().map(|t| t.hash()).collect(); - let tx_root = merkle_root(&tx_hashes[..]); + let tx_digests: Vec<_> = + p.candidate.txs().iter().map(|t| t.digest()).collect(); + let tx_root = merkle_root(&tx_digests[..]); if tx_root != p.candidate.header().txroot { return Err(ConsensusError::InvalidBlock); } @@ -186,9 +186,9 @@ fn verify_candidate_msg( } // Verify fault_root - let fault_hashes: Vec<_> = - p.candidate.faults().iter().map(|t| t.hash()).collect(); - let fault_root = merkle_root(&fault_hashes[..]); + let fault_digests: Vec<_> = + p.candidate.faults().iter().map(|t| t.digest()).collect(); + let fault_root = merkle_root(&fault_digests[..]); if fault_root != p.candidate.header().faultroot { return Err(ConsensusError::InvalidBlock); }