From 36210a9544fa789294265e4a997f553bcf88a202 Mon Sep 17 00:00:00 2001 From: Andrew Ayer Date: Tue, 15 Nov 2016 12:38:49 -0800 Subject: [PATCH] VerifyConsistencyProof: properly return tree builder when two trees are the same --- auditing.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/auditing.go b/auditing.go index a19e342..81c6f2b 100644 --- a/auditing.go +++ b/auditing.go @@ -28,7 +28,10 @@ func VerifyConsistencyProof(proof ct.ConsistencyProof, first *ct.SignedTreeHead, return false, nil } 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 { // The purpose of the consistency proof is to ensure the append-only