common: fix gas fee mismatch before TIPTRC21Fee, close XFN-51 (#1636)

This commit is contained in:
Daniel Liu 2025-11-03 18:54:14 +08:00 committed by GitHub
parent 815995e9e0
commit c3c3d03551
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View file

@ -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

View file

@ -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{