Remove enumerate_trie_root in favour of ordered_trie_root #2382 (#3360)

This commit is contained in:
Juan Aguilar
2019-08-12 16:13:02 +02:00
committed by Gavin Wood
parent 70d716dc48
commit db5e6712d7
8 changed files with 29 additions and 46 deletions
+3 -9
View File
@@ -466,12 +466,9 @@ pub trait Hash: 'static + MaybeSerializeDebug + Clone + Eq + PartialEq { // Stup
Encode::using_encoded(s, Self::hash)
}
/// Produce the trie-db root of a mapping from indices to byte slices.
fn enumerated_trie_root(items: &[&[u8]]) -> Self::Output;
/// Iterator-based version of `enumerated_trie_root`.
/// Iterator-based version of `ordered_trie_root`.
fn ordered_trie_root<
I: IntoIterator<Item = A> + Iterator<Item = A>,
I: IntoIterator<Item = A>,
A: AsRef<[u8]>
>(input: I) -> Self::Output;
@@ -500,9 +497,6 @@ impl Hash for BlakeTwo256 {
fn hash(s: &[u8]) -> Self::Output {
runtime_io::blake2_256(s).into()
}
fn enumerated_trie_root(items: &[&[u8]]) -> Self::Output {
runtime_io::enumerated_trie_root::<Blake2Hasher>(items).into()
}
fn trie_root<
I: IntoIterator<Item = (A, B)>,
A: AsRef<[u8]> + Ord,
@@ -511,7 +505,7 @@ impl Hash for BlakeTwo256 {
runtime_io::trie_root::<Blake2Hasher, _, _, _>(input).into()
}
fn ordered_trie_root<
I: IntoIterator<Item = A> + Iterator<Item = A>,
I: IntoIterator<Item = A>,
A: AsRef<[u8]>
>(input: I) -> Self::Output {
runtime_io::ordered_trie_root::<Blake2Hasher, _, _>(input).into()