mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
check data len for 0
This commit is contained in:
parent
aacecda1a4
commit
d56327b887
1 changed files with 3 additions and 0 deletions
|
|
@ -178,6 +178,9 @@ func GetHeight(count uint64) int {
|
||||||
// Count - Numers of leafs at the BMT
|
// Count - Numers of leafs at the BMT
|
||||||
// error -
|
// error -
|
||||||
func BuildBMT(h Hasher, data []byte, segmentsize int) (bmt *BTree, roor *Root, count int, err error) {
|
func BuildBMT(h Hasher, data []byte, segmentsize int) (bmt *BTree, roor *Root, count int, err error) {
|
||||||
|
if len(data) == 0 {
|
||||||
|
return nil, nil, 0, errors.New("data length is 0 ")
|
||||||
|
}
|
||||||
hashFunc = h
|
hashFunc = h
|
||||||
leafcount := len(data) / segmentsize
|
leafcount := len(data) / segmentsize
|
||||||
if len(data)%segmentsize != 0 {
|
if len(data)%segmentsize != 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue