func (kv KVPair) Bytes() []byte {
	var b bytes.Buffer
	err := amino.EncodeByteSlice(&b, kv.Key)
	if err != nil {
		panic(err)
	}
	err = amino.EncodeByteSlice(&b, kv.Value)
	if err != nil {
		panic(err)
	}
	return b.Bytes()
}
Bytes returns key || value, with both the
key and value length prefixed.
package merkle
import (
	"bytes"
	amino "github.com/tendermint/go-amino"
	"github.com/tendermint/tendermint/crypto/tmhash"
	cmn "github.com/tendermint/tendermint/libs/common"
)
type simpleMap struct {
	kvs    cmn.KVPairs
	sorted bool
}
func newSimpleMap() *simpleMap {
	return &simpleMap{
		kvs:    nil,
		sorted: false,
	}
}
func (sm *simpleMap) Set(key string, value []byte) {
	sm.sorted = false
	vhash := tmhash.Sum(value)
	sm.kvs = append(sm.kvs, cmn.KVPair{
		Key:   []byte(key),
		Value: vhash,
	})
}
func (sm *simpleMap) Hash() []byte {
	sm.Sort()
	return hashKVPairs(sm.kvs)
}
func (sm *simpleMap) Sort() {
	if sm.sorted {
		return
	}
	sm.kvs.Sort()
	sm.sorted = true
}
func (sm *simpleMap) KVPairs() cmn.KVPairs {
	sm.Sort()
	kvs := make(cmn.KVPairs, len(sm.kvs))
	copy(kvs, sm.kvs)
	return kvs
}
type KVPair cmn.KVPair