removes merkle root comparison in erasure_mismatch (#29447)
Merkle shreds within the same erasure batch have the same merkle root. The root of the merkle tree is signed. So either the signatures match or one fails sigverify, and the comparison of merkle roots is redundant.
This commit is contained in:
parent
50afb80f52
commit
70c901792e
|
@ -336,12 +336,6 @@ impl ShredCode {
|
|||
Some(offset..offset + SIZE_OF_MERKLE_ROOT)
|
||||
}
|
||||
|
||||
pub(super) fn erasure_mismatch(&self, other: &ShredCode) -> bool {
|
||||
shred_code::erasure_mismatch(self, other)
|
||||
|| self.merkle_root().ok() != other.merkle_root().ok()
|
||||
|| self.common_header.signature != other.common_header.signature
|
||||
}
|
||||
|
||||
fn from_recovered_shard(
|
||||
common_header: ShredCommonHeader,
|
||||
coding_header: CodingShredHeader,
|
||||
|
|
|
@ -79,8 +79,15 @@ impl ShredCode {
|
|||
pub(super) fn erasure_mismatch(&self, other: &ShredCode) -> bool {
|
||||
match (self, other) {
|
||||
(Self::Legacy(shred), Self::Legacy(other)) => erasure_mismatch(shred, other),
|
||||
(Self::Merkle(shred), Self::Merkle(other)) => shred.erasure_mismatch(other),
|
||||
_ => true,
|
||||
(Self::Legacy(_), Self::Merkle(_)) => true,
|
||||
(Self::Merkle(_), Self::Legacy(_)) => true,
|
||||
(Self::Merkle(shred), Self::Merkle(other)) => {
|
||||
// Merkle shreds within the same erasure batch have the same
|
||||
// merkle root. The root of the merkle tree is signed. So
|
||||
// either the signatures match or one fails sigverify.
|
||||
erasure_mismatch(shred, other)
|
||||
|| shred.common_header().signature != other.common_header().signature
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue