package ethdb_test import ( "context" "errors" "fmt" "testing" "time" "github.com/ledgerwatch/turbo-geth/common" "github.com/ledgerwatch/turbo-geth/common/dbutils" "github.com/ledgerwatch/turbo-geth/ethdb" "github.com/ledgerwatch/turbo-geth/ethdb/remote" "github.com/ledgerwatch/turbo-geth/ethdb/remote/remotedbserver" "github.com/ledgerwatch/turbo-geth/log" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/test/bufconn" ) func TestManagedTx(t *testing.T) { defaultConfig := dbutils.BucketsCfg defer func() { dbutils.BucketsCfg = defaultConfig }() bucketID := 0 bucket1 := dbutils.Buckets[bucketID] bucket2 := dbutils.Buckets[bucketID+1] dbutils.BucketsCfg[bucket1].IsDupSort = true dbutils.BucketsCfg[bucket1].DupFromLen = 6 dbutils.BucketsCfg[bucket1].DupToLen = 4 dbutils.BucketsCfg[bucket2].IsDupSort = false writeDBs, readDBs, closeAll := setupDatabases() defer closeAll() ctx := context.Background() for _, db := range writeDBs { db := db if err := db.Update(ctx, func(tx ethdb.Tx) error { c := tx.Cursor(bucket1) c1 := tx.Cursor(bucket2) require.NoError(t, c.Append([]byte{0}, []byte{1})) require.NoError(t, c1.Append([]byte{0}, []byte{1})) require.NoError(t, c.Append([]byte{0, 0, 0, 0, 0, 1}, []byte{1})) // prefixes of len=FromLen for DupSort test (other keys must be