mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-22 20:56:42 +00:00
Update pebble.go
This commit is contained in:
parent
e6d34c1fee
commit
f3ba4d9994
1 changed files with 9 additions and 1 deletions
|
|
@ -688,7 +688,15 @@ func (b *batch) Replay(w ethdb.KeyValueWriter) error {
|
||||||
for {
|
for {
|
||||||
kind, k, v, ok, err := reader.Next()
|
kind, k, v, ok, err := reader.Next()
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return err
|
// Provide better error context when batch is invalid.
|
||||||
|
// This error typically occurs when trying to read a corrupted batch.
|
||||||
|
if err != nil {
|
||||||
|
if strings.Contains(err.Error(), "invalid batch") {
|
||||||
|
return fmt.Errorf("decoding SET value: %w", err)
|
||||||
|
}
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
// The (k,v) slices might be overwritten if the batch is reset/reused,
|
// The (k,v) slices might be overwritten if the batch is reset/reused,
|
||||||
// and the receiver should copy them if they are to be retained long-term.
|
// and the receiver should copy them if they are to be retained long-term.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue