|
|
- package types
-
- import (
- "github.com/tendermint/go-merkle"
- )
-
- type Tx []byte
-
- type Txs []Tx
-
- func (txs Txs) Hash() []byte {
- // Recursive impl.
- // Copied from go-merkle to avoid allocations
- switch len(txs) {
- case 0:
- return nil
- case 1:
- return merkle.SimpleHashFromBinary(txs[0])
- default:
- left := Txs(txs[:(len(txs)+1)/2]).Hash()
- right := Txs(txs[(len(txs)+1)/2:]).Hash()
- return merkle.SimpleHashFromTwoHashes(left, right)
- }
- }
|