diff --git a/common/debug/experiments.go b/common/debug/experiments.go index 934819771..eff72ea66 100644 --- a/common/debug/experiments.go +++ b/common/debug/experiments.go @@ -6,11 +6,6 @@ import ( "sync/atomic" ) -var ( - compressBlocks bool - getCompressBlocks sync.Once -) - // atomic: bit 0 is the value, bit 1 is the initialized flag var getNodeData uint32 @@ -47,13 +42,6 @@ func OverrideGetNodeData(val bool) { } } -func IsBlockCompressionEnabled() bool { - getCompressBlocks.Do(func() { - _, compressBlocks = os.LookupEnv("COMPRESS_BLOCKS") - }) - return compressBlocks -} - var ( testDB string getTestDB sync.Once diff --git a/core/rawdb/accessors_chain.go b/core/rawdb/accessors_chain.go index 8e6f1ee92..53251b7df 100644 --- a/core/rawdb/accessors_chain.go +++ b/core/rawdb/accessors_chain.go @@ -24,17 +24,13 @@ import ( "fmt" "math/big" - "github.com/ledgerwatch/turbo-geth/ethdb" - "github.com/ledgerwatch/turbo-geth/ethdb/cbor" - "github.com/ledgerwatch/turbo-geth/common" "github.com/ledgerwatch/turbo-geth/common/dbutils" - "github.com/ledgerwatch/turbo-geth/common/debug" "github.com/ledgerwatch/turbo-geth/core/types" + "github.com/ledgerwatch/turbo-geth/ethdb" + "github.com/ledgerwatch/turbo-geth/ethdb/cbor" "github.com/ledgerwatch/turbo-geth/log" "github.com/ledgerwatch/turbo-geth/rlp" - - "github.com/golang/snappy" ) // ReadCanonicalHash retrieves the hash assigned to a canonical block number. @@ -334,9 +330,6 @@ func WriteTransactions(db ethdb.Database, txs []*types.Transaction, baseTxId uin // WriteBodyRLP stores an RLP encoded block body into the database. func WriteBodyRLP(db DatabaseWriter, hash common.Hash, number uint64, rlp rlp.RawValue) { - if debug.IsBlockCompressionEnabled() { - rlp = snappy.Encode(nil, rlp) - } if err := db.Put(dbutils.BlockBodyPrefix, dbutils.BlockBodyKey(number, hash), rlp); err != nil { log.Crit("Failed to store block body", "err", err) } diff --git a/migrations/transactions.go b/migrations/transactions.go index aa563db74..24c870624 100644 --- a/migrations/transactions.go +++ b/migrations/transactions.go @@ -6,9 +6,7 @@ import ( "fmt" "time" - "github.com/golang/snappy" "github.com/ledgerwatch/turbo-geth/common/dbutils" - "github.com/ledgerwatch/turbo-geth/common/debug" "github.com/ledgerwatch/turbo-geth/common/etl" "github.com/ledgerwatch/turbo-geth/core/types" "github.com/ledgerwatch/turbo-geth/ethdb" @@ -23,18 +21,6 @@ var transactionsTable = Migration{ defer logEvery.Stop() logPrefix := "tx_table" - decompressBlockBody := func(compressed []byte) ([]byte, error) { - if !debug.IsBlockCompressionEnabled() || len(compressed) == 0 { - return compressed, nil - } - - var bodyRlp []byte - bodyRlp, err = snappy.Decode(nil, compressed) - if err != nil { - return nil, fmt.Errorf("err on decode block: %w", err) - } - return bodyRlp, nil - } const loadStep = "load" reader := bytes.NewReader(nil) buf := bytes.NewBuffer(make([]byte, 4096)) @@ -102,13 +88,7 @@ var transactionsTable = Migration{ } // don't need canonical check - var bodyRlp []byte - bodyRlp, err = decompressBlockBody(v) - if err != nil { - return false, err - } - - reader.Reset(bodyRlp) + reader.Reset(v) if err = rlp.Decode(reader, body); err != nil { return false, fmt.Errorf("[%s]: invalid block body RLP: %w", logPrefix, err) }