mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 11:31:08 +03:00
Index first when hashing nodes in MMR. Fixes #814
This commit is contained in:
parent
1300d7a745
commit
054114027f
1 changed files with 2 additions and 2 deletions
|
@ -565,14 +565,14 @@ pub trait PMMRIndexHashable {
|
||||||
|
|
||||||
impl<T: PMMRable> PMMRIndexHashable for T {
|
impl<T: PMMRable> PMMRIndexHashable for T {
|
||||||
fn hash_with_index(&self, index: u64) -> Hash {
|
fn hash_with_index(&self, index: u64) -> Hash {
|
||||||
(self, index).hash()
|
(index, self).hash()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convenient way to hash two existing hashes together with an index.
|
// Convenient way to hash two existing hashes together with an index.
|
||||||
impl PMMRIndexHashable for (Hash, Hash) {
|
impl PMMRIndexHashable for (Hash, Hash) {
|
||||||
fn hash_with_index(&self, index: u64) -> Hash {
|
fn hash_with_index(&self, index: u64) -> Hash {
|
||||||
(&self.0, &self.1, index).hash()
|
(index, &self.0, &self.1).hash()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue