From accacae62daf1119ac25b76a0e867b5ecae672eb Mon Sep 17 00:00:00 2001 From: Arnaud Briche Date: Wed, 14 Feb 2024 10:23:59 +0100 Subject: [PATCH] fix: switch to atomic.Pointer for rollupGas only --- core/types/transaction.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/types/transaction.go b/core/types/transaction.go index e8db1dc661d..4a823b0a38e 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -104,7 +104,7 @@ type TransactionMisc struct { from atomic.Value // cache how much gas the tx takes on L1 for its share of rollup data - rollupGas atomic.Value + rollupGas atomic.Pointer[types2.RollupCostData] } type rollupGasCounter struct { @@ -134,7 +134,7 @@ func (tm *TransactionMisc) computeRollupGas(tx interface { return types2.RollupCostData{} } if v := tm.rollupGas.Load(); v != nil { - return v.(types2.RollupCostData) + return *v } var c rollupGasCounter var buf bytes.Buffer @@ -147,7 +147,7 @@ func (tm *TransactionMisc) computeRollupGas(tx interface { log.Error("failed to compute rollup cost data", "err", err) } total := types2.RollupCostData{Zeroes: c.zeroes, Ones: c.ones, FastLzSize: c.fastLzSize} - tm.rollupGas.Store(total) + tm.rollupGas.Store(&total) return total }