VerifyConsistencyProof: properly return tree builder when two trees are the same

This commit is contained in:
Andrew Ayer 2016-11-15 12:38:49 -08:00
parent 31f2316aa2
commit 36210a9544
1 changed files with 4 additions and 1 deletions

View File

@ -28,7 +28,10 @@ func VerifyConsistencyProof(proof ct.ConsistencyProof, first *ct.SignedTreeHead,
return false, nil return false, nil
} }
if first.TreeSize == second.TreeSize { if first.TreeSize == second.TreeSize {
return bytes.Equal(first.SHA256RootHash[:], second.SHA256RootHash[:]) && len(proof) == 0, nil if !(bytes.Equal(first.SHA256RootHash[:], second.SHA256RootHash[:]) && len(proof) == 0) {
return false, nil
}
return true, &MerkleTreeBuilder{stack: []ct.MerkleTreeNode{first.SHA256RootHash[:]}, size: 1}
} }
if first.TreeSize == 0 { if first.TreeSize == 0 {
// The purpose of the consistency proof is to ensure the append-only // The purpose of the consistency proof is to ensure the append-only