This commit is contained in:
ericxtheodore 2025-07-28 15:10:13 +08:00 committed by GitHub
parent ec4d97e04f
commit ea5cbbc961
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -22,6 +22,7 @@ package leveldb
import (
"bytes"
"errors"
"fmt"
"sync"
"time"
@ -31,7 +32,7 @@ import (
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/metrics"
"github.com/syndtr/goleveldb/leveldb"
"github.com/syndtr/goleveldb/leveldb/errors"
lerrors "github.com/syndtr/goleveldb/leveldb/errors"
"github.com/syndtr/goleveldb/leveldb/filter"
"github.com/syndtr/goleveldb/leveldb/opt"
"github.com/syndtr/goleveldb/leveldb/util"
@ -120,7 +121,7 @@ func NewCustom(file string, namespace string, customize func(options *opt.Option
// Open the db and recover any potential corruptions
db, err := leveldb.OpenFile(file, options)
if _, corrupted := err.(*errors.ErrCorrupted); corrupted {
if _, corrupted := err.(*lerrors.ErrCorrupted); corrupted {
db, err = leveldb.RecoverFile(file, nil)
}
if err != nil {
@ -548,7 +549,7 @@ func (r *replayer) DeleteRange(start, end []byte) {
if rangeDeleter, ok := r.writer.(ethdb.KeyValueRangeDeleter); ok {
r.failure = rangeDeleter.DeleteRange(start, end)
} else {
r.failure = fmt.Errorf("ethdb.KeyValueWriter does not implement DeleteRange")
r.failure = errors.New("ethdb.KeyValueWriter does not implement DeleteRange")
}
}

View file

@ -17,6 +17,7 @@
package tests
import (
"errors"
"fmt"
"math/big"
@ -43,7 +44,7 @@ type ttFork struct {
func (tt *TransactionTest) validate() error {
if tt.Txbytes == nil {
return fmt.Errorf("missing txbytes")
return errors.New("missing txbytes")
}
for name, fork := range tt.Result {
if err := tt.validateFork(fork); err != nil {
@ -58,10 +59,10 @@ func (tt *TransactionTest) validateFork(fork *ttFork) error {
return nil
}
if fork.Hash == nil && fork.Exception == nil {
return fmt.Errorf("missing hash and exception")
return errors.New("missing hash and exception")
}
if fork.Hash != nil && fork.Sender == nil {
return fmt.Errorf("missing sender")
return errors.New("missing sender")
}
return nil
}