diff --git a/core/types/transaction.go b/core/types/transaction.go index 65f64fe038d6..bb9b31dd36f5 100644 --- a/core/types/transaction.go +++ b/core/types/transaction.go @@ -859,3 +859,7 @@ func (m *Message) SetBalanceTokenFeeForCall() { m.balanceTokenFee = new(big.Int).SetUint64(m.gasLimit) m.balanceTokenFee.Mul(m.balanceTokenFee, m.gasPrice) } + +func (m *Message) SetBalanceTokenFee(balanceTokenFee *big.Int) { + m.balanceTokenFee = balanceTokenFee +} diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 74defd2a748a..59fbea76146c 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -2057,12 +2057,19 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH } // Copy the original db so we don't modify it statedb := db.Copy() + // Set the accesslist to the last al + args.AccessList = &accessList + msg, err := args.ToMessage(b, block.Number(), b.RPCGasCap(), header.BaseFee) + if err != nil { + return nil, 0, nil, err + } + feeCapacity := state.GetTRC21FeeCapacityFromState(statedb) var balanceTokenFee *big.Int if value, ok := feeCapacity[to]; ok { balanceTokenFee = value } - msg := types.NewMessage(args.from(), args.To, uint64(*args.Nonce), args.Value.ToInt(), uint64(*args.Gas), args.GasPrice.ToInt(), big.NewInt(0), big.NewInt(0), args.data(), accessList, false, balanceTokenFee, header.Number) + msg.SetBalanceTokenFee(balanceTokenFee) // Apply the transaction with the access list tracer tracer := vm.NewAccessListTracer(accessList, args.from(), to, precompiles)