From 798a7655a1b1125ab66e7133079328c9ccc1ac8e Mon Sep 17 00:00:00 2001 From: awskii Date: Thu, 12 Dec 2024 17:14:11 +0000 Subject: [PATCH] svae --- erigon-lib/state/domain.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/erigon-lib/state/domain.go b/erigon-lib/state/domain.go index 8b439e84909..7c554375b2d 100644 --- a/erigon-lib/state/domain.go +++ b/erigon-lib/state/domain.go @@ -1724,13 +1724,19 @@ func (dt *DomainRoTx) valsCursor(tx kv.Tx) (c kv.Cursor, err error) { panic(fmt.Errorf("%w: cursor parent tx %x; current tx %x", sdTxImmutabilityInvariant, dt.valCViewID, tx.ViewID())) // cursor opened by different tx, invariant broken } if dt.d.largeValues { - if mc, ok := dt.valsC.(*mdbx.MdbxCursor); ok && !mc.IsClosed() { + if mc, ok := dt.valsC.(*mdbx.MdbxCursor); ok { + if mc.IsClosed() { + panic("domainRoTx lives longer than cursor (=> than tx opened that cursor)") + } //fmt.Printf("reuse %d closed=%t\n", tx.ViewID(), mc.IsClosed()) return mc, nil } } else { - if mc, ok := dt.valsC.(*mdbx.MdbxDupSortCursor); ok && !mc.IsClosed() { + if mc, ok := dt.valsC.(*mdbx.MdbxDupSortCursor); ok { //fmt.Printf("dsreuse %d closed=%t\n", tx.ViewID(), mc.IsClosed()) + if mc.IsClosed() { + panic("domainRoTx lives longer than cursor (=> than tx opened that cursor)") + } return mc, nil } }