triehash is separated from util (#6428)
This commit is contained in:
@@ -20,9 +20,10 @@ use std::cmp;
|
||||
use std::sync::Arc;
|
||||
use std::collections::HashSet;
|
||||
use hash::{keccak, KECCAK_NULL_RLP, KECCAK_EMPTY_LIST_RLP};
|
||||
use triehash::ordered_trie_root;
|
||||
|
||||
use rlp::{UntrustedRlp, RlpStream, Encodable, Decodable, DecoderError};
|
||||
use util::{Bytes, Address, U256, H256, ordered_trie_root};
|
||||
use util::{Bytes, Address, U256, H256};
|
||||
use util::error::{Mismatch, OutOfBounds};
|
||||
|
||||
use basic_types::{LogBloom, Seal};
|
||||
|
||||
@@ -353,7 +353,7 @@ impl ValidatorSet for ValidatorSafeContract {
|
||||
|
||||
// ensure receipts match header.
|
||||
// TODO: optimize? these were just decoded.
|
||||
let found_root = ::util::triehash::ordered_trie_root(
|
||||
let found_root = ::triehash::ordered_trie_root(
|
||||
receipts.iter().map(::rlp::encode).map(|x| x.to_vec())
|
||||
);
|
||||
if found_root != *old_header.receipts_root() {
|
||||
|
||||
@@ -104,6 +104,7 @@ extern crate rand;
|
||||
extern crate rlp;
|
||||
extern crate hash;
|
||||
extern crate heapsize;
|
||||
extern crate triehash;
|
||||
extern crate ansi_term;
|
||||
extern crate semantic_version;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ use std::fmt;
|
||||
use std::collections::BTreeMap;
|
||||
use itertools::Itertools;
|
||||
use hash::{keccak};
|
||||
use triehash::sec_trie_root;
|
||||
use util::*;
|
||||
use state::Account;
|
||||
use ethjson;
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
use std::fmt;
|
||||
use std::collections::BTreeMap;
|
||||
use itertools::Itertools;
|
||||
use triehash::sec_trie_root;
|
||||
use util::*;
|
||||
use pod_account::{self, PodAccount};
|
||||
use types::state_diff::StateDiff;
|
||||
|
||||
@@ -23,7 +23,7 @@ use hash::keccak;
|
||||
use views::BlockView;
|
||||
use rlp::{DecoderError, RlpStream, UntrustedRlp};
|
||||
use util::{Bytes, H256};
|
||||
use util::triehash::ordered_trie_root;
|
||||
use triehash::ordered_trie_root;
|
||||
|
||||
const HEADER_FIELDS: usize = 8;
|
||||
const BLOCK_FIELDS: usize = 2;
|
||||
@@ -190,7 +190,7 @@ mod tests {
|
||||
b.transactions.push(t2.into());
|
||||
|
||||
let receipts_root = b.header.receipts_root().clone();
|
||||
b.header.set_transactions_root(::util::triehash::ordered_trie_root(
|
||||
b.header.set_transactions_root(::triehash::ordered_trie_root(
|
||||
b.transactions.iter().map(::rlp::encode).map(|out| out.into_vec())
|
||||
));
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ impl Rebuilder for PowRebuilder {
|
||||
use views::BlockView;
|
||||
use snapshot::verify_old_block;
|
||||
use util::U256;
|
||||
use util::triehash::ordered_trie_root;
|
||||
use triehash::ordered_trie_root;
|
||||
|
||||
let rlp = UntrustedRlp::new(chunk);
|
||||
let item_count = rlp.item_count()?;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
use std::collections::HashSet;
|
||||
use hash::keccak;
|
||||
use triehash::ordered_trie_root;
|
||||
use heapsize::HeapSizeOf;
|
||||
use util::*;
|
||||
use engines::Engine;
|
||||
@@ -269,6 +270,7 @@ fn verify_block_integrity(block: &[u8], transactions_root: &H256, uncles_hash: &
|
||||
mod tests {
|
||||
use std::collections::{BTreeMap, HashMap};
|
||||
use hash::keccak;
|
||||
use triehash::ordered_trie_root;
|
||||
use util::*;
|
||||
use ethkey::{Random, Generator};
|
||||
use header::*;
|
||||
|
||||
Reference in New Issue
Block a user