Skip to content

Commit

Permalink
Merge pull request #128 from celestiaorg/fix-reset
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan authored Oct 5, 2022
2 parents 9bee7da + ed5b81e commit 21e6086
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions datasquare.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,15 @@ func (ds *dataSquare) setColSlice(x uint, y uint, newCol [][]byte) error {
}

func (ds *dataSquare) resetRoots() {
ds.rowRoots = nil
ds.colRoots = nil
// don't write nil if it's already nil
// this prevents rewriting nil into shared memory slot
// when resetRoots is used from multiple routines
if ds.rowRoots != nil {
ds.rowRoots = nil
}
if ds.colRoots != nil {
ds.colRoots = nil
}
}

func (ds *dataSquare) computeRoots() {
Expand Down

0 comments on commit 21e6086

Please sign in to comment.