diff --git a/accounts/abi/bind/backends/simulated.go b/accounts/abi/bind/backends/simulated.go index ff2f1393b..e1b8a6390 100644 --- a/accounts/abi/bind/backends/simulated.go +++ b/accounts/abi/bind/backends/simulated.go @@ -177,7 +177,7 @@ func (b *SimulatedBackend) emptyPendingBlock() { if b.pendingReaderTx != nil { b.pendingReaderTx.Rollback() } - tx, err := b.m.DB.BeginRo(context.Background()) + tx, err := b.m.DB.BeginRo(context.Background()) //nolint:gocritic if err != nil { panic(err) } diff --git a/cmd/rpctest/rpctest/account_range_verify.go b/cmd/rpctest/rpctest/account_range_verify.go index dcb89c619..ed1bef30e 100644 --- a/cmd/rpctest/rpctest/account_range_verify.go +++ b/cmd/rpctest/rpctest/account_range_verify.go @@ -122,11 +122,13 @@ func CompareAccountRange(logger log.Logger, erigonURL, gethURL, tmpDataDir, geth log.Error(err.Error()) return } + defer tgTx.Rollback() gethTx, err := gethKV.BeginRo(context.Background()) if err != nil { log.Error(err.Error()) return } + defer gethTx.Rollback() tgCursor, err := tgTx.Cursor(kv.E2AccountsHistory) if err != nil { log.Error(err.Error()) diff --git a/core/state/temporal/kv_temporal.go b/core/state/temporal/kv_temporal.go index 3ebd94952..8be4940df 100644 --- a/core/state/temporal/kv_temporal.go +++ b/core/state/temporal/kv_temporal.go @@ -105,7 +105,7 @@ func (db *DB) Agg() *state.AggregatorV3 { return db.agg } func (db *DB) InternalDB() kv.RwDB { return db.RwDB } func (db *DB) BeginTemporalRo(ctx context.Context) (kv.TemporalTx, error) { - kvTx, err := db.RwDB.BeginRo(ctx) + kvTx, err := db.RwDB.BeginRo(ctx) //nolint:gocritic if err != nil { return nil, err } diff --git a/erigon-lib/rules.go b/erigon-lib/rules.go index 80485ab1e..dde688bbc 100644 --- a/erigon-lib/rules.go +++ b/erigon-lib/rules.go @@ -34,6 +34,8 @@ func txDeferRollback(m dsl.Matcher) { `$tx, $err = $db.BeginRw($ctx); $chk; $rollback`, `$tx, $err := $db.Begin($ctx); $chk; $rollback`, `$tx, $err = $db.Begin($ctx); $chk; $rollback`, + `$tx, $err := $db.BeginRo($ctx); $chk; $rollback`, + `$tx, $err = $db.BeginRo($ctx); $chk; $rollback`, ). Where(!m["rollback"].Text.Matches(`defer .*\.Rollback()`)). //At(m["rollback"]). diff --git a/rules.go b/rules.go index f947bc0eb..889b03bf6 100644 --- a/rules.go +++ b/rules.go @@ -33,6 +33,8 @@ func txDeferRollback(m dsl.Matcher) { `$tx, $err = $db.BeginRw($ctx); $chk; $rollback`, `$tx, $err := $db.Begin($ctx); $chk; $rollback`, `$tx, $err = $db.Begin($ctx); $chk; $rollback`, + `$tx, $err := $db.BeginRo($ctx); $chk; $rollback`, + `$tx, $err = $db.BeginRo($ctx); $chk; $rollback`, ). Where(!m["rollback"].Text.Matches(`defer .*\.Rollback()`)). //At(m["rollback"]). diff --git a/turbo/jsonrpc/erigon_cache_check.go b/turbo/jsonrpc/erigon_cache_check.go index 903ca3c94..a487af36c 100644 --- a/turbo/jsonrpc/erigon_cache_check.go +++ b/turbo/jsonrpc/erigon_cache_check.go @@ -14,6 +14,7 @@ func (api *ErigonImpl) CacheCheck() (*kvcache.CacheValidationResult, error) { if err != nil { return nil, err } + defer tx.Rollback() result, err := cache.ValidateCurrentRoot(ctx, tx) if err != nil {