Skip to content

Commit

Permalink
Merge pull request #265 from uprendis/feature/deescalate-snap2kvdb
Browse files Browse the repository at this point in the history
Replace panics in snap2kvdb with warnings
  • Loading branch information
uprendis authored Mar 10, 2022
2 parents afaa208 + 7f06af6 commit 64918fe
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions utils/adapters/snap2kvdb/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package snap2kvdb

import (
"github.com/Fantom-foundation/lachesis-base/kvdb"
"github.com/Fantom-foundation/lachesis-base/kvdb/devnulldb"
"github.com/ethereum/go-ethereum/log"
)

type Adapter struct {
Expand All @@ -15,12 +17,12 @@ func Wrap(v kvdb.Snapshot) *Adapter {
}

func (db *Adapter) Put(key []byte, value []byte) error {
panic("called Put on snapshot")
log.Warn("called Put on snapshot")
return nil
}

func (db *Adapter) Delete(key []byte) error {
panic("called Delete on snapshot")
log.Warn("called Delete on snapshot")
return nil
}

Expand All @@ -29,8 +31,8 @@ func (db *Adapter) GetSnapshot() (kvdb.Snapshot, error) {
}

func (db *Adapter) NewBatch() kvdb.Batch {
panic("called NewBatch on snapshot")
return nil
log.Warn("called NewBatch on snapshot")
return devnulldb.New().NewBatch()
}

func (db *Adapter) Compact(start []byte, limit []byte) error {
Expand Down

0 comments on commit 64918fe

Please sign in to comment.