From 384ffa238da7bf45d9c4af88b274c081da6ecfb2 Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Thu, 27 Oct 2022 10:51:55 +0200 Subject: [PATCH] Remove storage snapshot functions (#830) --- blockchain/storage/keyvalue.go | 17 ----------------- blockchain/storage/storage.go | 3 --- blockchain/storage/testing.go | 26 -------------------------- 3 files changed, 46 deletions(-) diff --git a/blockchain/storage/keyvalue.go b/blockchain/storage/keyvalue.go index c369c4bd5d..9d2421facf 100644 --- a/blockchain/storage/keyvalue.go +++ b/blockchain/storage/keyvalue.go @@ -221,23 +221,6 @@ func (s *KeyValueStorage) ReadBody(hash types.Hash) (*types.Body, error) { return body, err } -// SNAPSHOTS // - -// WriteSnapshot writes the snapshot to the DB -func (s *KeyValueStorage) WriteSnapshot(hash types.Hash, blob []byte) error { - return s.set(SNAPSHOTS, hash.Bytes(), blob) -} - -// ReadSnapshot reads the snapshot from the DB -func (s *KeyValueStorage) ReadSnapshot(hash types.Hash) ([]byte, bool) { - data, ok := s.get(SNAPSHOTS, hash.Bytes()) - if !ok { - return []byte{}, false - } - - return data, true -} - // RECEIPTS // // WriteReceipts writes the receipts diff --git a/blockchain/storage/storage.go b/blockchain/storage/storage.go index 440adfcb29..1010e8a2f1 100644 --- a/blockchain/storage/storage.go +++ b/blockchain/storage/storage.go @@ -31,9 +31,6 @@ type Storage interface { WriteBody(hash types.Hash, body *types.Body) error ReadBody(hash types.Hash) (*types.Body, error) - WriteSnapshot(hash types.Hash, blob []byte) error - ReadSnapshot(hash types.Hash) ([]byte, bool) - WriteReceipts(hash types.Hash, receipts []*types.Receipt) error ReadReceipts(hash types.Hash) ([]*types.Receipt, error) diff --git a/blockchain/storage/testing.go b/blockchain/storage/testing.go index 53da5ed6f1..1b3f9e5d27 100644 --- a/blockchain/storage/testing.go +++ b/blockchain/storage/testing.go @@ -487,8 +487,6 @@ type MockStorage struct { writeCanonicalHeaderFn writeCanonicalHeaderDelegate writeBodyFn writeBodyDelegate readBodyFn readBodyDelegate - writeSnapshotFn writeSnapshotDelegate - readSnapshotFn readSnapshotDelegate writeReceiptsFn writeReceiptsDelegate readReceiptsFn readReceiptsDelegate writeTxLookupFn writeTxLookupDelegate @@ -680,30 +678,6 @@ func (m *MockStorage) HookReadBody(fn readBodyDelegate) { m.readBodyFn = fn } -func (m *MockStorage) WriteSnapshot(hash types.Hash, blob []byte) error { - if m.writeSnapshotFn != nil { - return m.writeSnapshotFn(hash, blob) - } - - return nil -} - -func (m *MockStorage) HookWriteSnapshot(fn writeSnapshotDelegate) { - m.writeSnapshotFn = fn -} - -func (m *MockStorage) ReadSnapshot(hash types.Hash) ([]byte, bool) { - if m.readSnapshotFn != nil { - return m.readSnapshotFn(hash) - } - - return []byte{}, true -} - -func (m *MockStorage) HookReadSnapshot(fn readSnapshotDelegate) { - m.readSnapshotFn = fn -} - func (m *MockStorage) WriteReceipts(hash types.Hash, receipts []*types.Receipt) error { if m.writeReceiptsFn != nil { return m.writeReceiptsFn(hash, receipts)