From c3c3d03551f758fae208770b19f2cfc08a37a5af Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Mon, 3 Nov 2025 18:54:14 +0800 Subject: [PATCH] common: fix gas fee mismatch before TIPTRC21Fee, close XFN-51 (#1636) --- common/gas.go | 2 ++ contracts/trc21issuer/trc21issuer_test.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/common/gas.go b/common/gas.go index 1e40721b14..7f1135ceea 100644 --- a/common/gas.go +++ b/common/gas.go @@ -13,6 +13,8 @@ func GetGasFee(blockNumber, gas uint64) *big.Int { fee = fee.Mul(fee, GasPrice50x) } else if blockNumber > TIPTRC21Fee.Uint64() { fee = fee.Mul(fee, TRC21GasPrice) + } else { + fee = fee.Mul(fee, TRC21GasPriceBefore) } return fee diff --git a/contracts/trc21issuer/trc21issuer_test.go b/contracts/trc21issuer/trc21issuer_test.go index 19e3dde595..42b750cb0f 100644 --- a/contracts/trc21issuer/trc21issuer_test.go +++ b/contracts/trc21issuer/trc21issuer_test.go @@ -30,6 +30,12 @@ var ( ) func TestFeeTxWithTRC21Token(t *testing.T) { + oldTRC21GasPriceBefore := new(big.Int).Set(common.TIPTRC21Fee) + defer func() { + common.TIPTRC21Fee = oldTRC21GasPriceBefore + }() + common.TRC21GasPriceBefore = big.NewInt(1) + // init genesis contractBackend := backends.NewXDCSimulatedBackend( types.GenesisAlloc{