Make txs and evidencelist use merkle.SimpleHashFromBytes to create hash (#2635)

This is a performance regression, but will also spare the types directory
from knowing about RFC 6962, which is a more correct abstraction. For txs
this performance hit will be fixed soon with #2603. For evidence, the
performance impact is negligible due to it being capped at a small number.
This commit is contained in:
Dev Ojha
2018-10-15 15:42:47 -05:00
committed by Ethan Buchman
parent 4ab7dcf3ac
commit 124d0db1e0
6 changed files with 33 additions and 30 deletions

View File

@ -4,8 +4,8 @@ import (
"github.com/tendermint/tendermint/crypto/tmhash"
)
// SimpleHashFromTwoHashes is the basic operation of the Merkle tree: Hash(left | right).
func SimpleHashFromTwoHashes(left, right []byte) []byte {
// simpleHashFromTwoHashes is the basic operation of the Merkle tree: Hash(left | right).
func simpleHashFromTwoHashes(left, right []byte) []byte {
var hasher = tmhash.New()
err := encodeByteSlice(hasher, left)
if err != nil {
@ -29,7 +29,7 @@ func SimpleHashFromByteSlices(items [][]byte) []byte {
default:
left := SimpleHashFromByteSlices(items[:(len(items)+1)/2])
right := SimpleHashFromByteSlices(items[(len(items)+1)/2:])
return SimpleHashFromTwoHashes(left, right)
return simpleHashFromTwoHashes(left, right)
}
}