Skip to content

Commit

Permalink
e3: don't loose nil-value in reconstitution (erigontech#7117)
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored and calmbeing committed Apr 24, 2023
1 parent ac23b2d commit 7c19d9f
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions eth/stagedsync/exec3.go
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,11 @@ func reconstituteStep(last bool,
}
lastKey = append(lastKey[:0], k[:len(k)-8]...)
}
lastVal = append(lastVal[:0], v...)
if v == nil { // `nil` value means delete, `empty value []byte{}` means empty value
lastVal = nil
} else {
lastVal = append(lastVal[:0], v...)
}
return nil
}, etl.TransformArgs{}); err != nil {
return err
Expand Down Expand Up @@ -1241,7 +1245,11 @@ func reconstituteStep(last bool,
}
lastKey = append(lastKey[:0], k[:len(k)-8]...)
}
lastVal = append(lastVal[:0], v...)
if v == nil {
lastVal = nil
} else {
lastVal = append(lastVal[:0], v...)
}
return nil
}, etl.TransformArgs{}); err != nil {
return err
Expand Down Expand Up @@ -1269,7 +1277,11 @@ func reconstituteStep(last bool,
}
lastKey = append(lastKey[:0], k[:len(k)-8]...)
}
lastVal = append(lastVal[:0], v...)
if v == nil {
lastVal = nil
} else {
lastVal = append(lastVal[:0], v...)
}
return nil
}, etl.TransformArgs{}); err != nil {
return err
Expand Down

0 comments on commit 7c19d9f

Please sign in to comment.