Skip to content

Commit

Permalink
Merge pull request #30 from lazyledger/hlib/digest-bytes-bug
Browse files Browse the repository at this point in the history
Use append on freshly created slice instead of on `d.nid`. This hopefully appeases the race detector in 
celestiaorg/celestia-core#248 (comment)
  • Loading branch information
liamsi committed Mar 29, 2021
2 parents babfaf9 + 2198e0e commit ddcc720
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion namespace/digest.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ func (d IntervalDigest) Hash() []byte {
}

func (d IntervalDigest) Bytes() []byte {
return append(append(d.min, d.max...), d.digest...)
return append(append(append(
make([]byte, 0, len(d.min)*2+len(d.digest)),
d.min...),
d.max...),
d.digest...)
}

func (d *IntervalDigest) Equal(to *IntervalDigest) bool {
Expand Down

0 comments on commit ddcc720

Please sign in to comment.