Skip to content

Commit

Permalink
Merge pull request #1510 from 0chain/hotfix/empty-root
Browse files Browse the repository at this point in the history
Add check for empty root hash
  • Loading branch information
dabasov authored Nov 17, 2024
2 parents 0af6dbd + cb05a57 commit 3e3d534
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion code/go/0chain.net/blobbercore/allocation/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore"
"github.com/0chain/blobber/code/go/0chain.net/core/common"
"github.com/0chain/common/core/encryption"
"github.com/0chain/common/core/util/wmpt"
"gorm.io/gorm/clause"

Expand Down Expand Up @@ -93,7 +94,7 @@ func (Allocation) TableName() string {
func (a *Allocation) GetTrie() *wmpt.WeightedMerkleTrie {
trie := Repo.getTrie(a.ID)
if trie == nil {
if a.FileMetaRoot == "" {
if a.FileMetaRoot == "" || a.FileMetaRoot == encryption.EmptyHash {
trie = wmpt.New(nil, datastore.GetBlockStore())
} else {
decodedRoot, _ := hex.DecodeString(a.FileMetaRoot)
Expand Down

0 comments on commit 3e3d534

Please sign in to comment.