mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 18:30:45 +00:00
common: fix gas fee mismatch before TIPTRC21Fee, close XFN-51 (#1636)
This commit is contained in:
parent
815995e9e0
commit
c3c3d03551
2 changed files with 8 additions and 0 deletions
|
|
@ -13,6 +13,8 @@ func GetGasFee(blockNumber, gas uint64) *big.Int {
|
||||||
fee = fee.Mul(fee, GasPrice50x)
|
fee = fee.Mul(fee, GasPrice50x)
|
||||||
} else if blockNumber > TIPTRC21Fee.Uint64() {
|
} else if blockNumber > TIPTRC21Fee.Uint64() {
|
||||||
fee = fee.Mul(fee, TRC21GasPrice)
|
fee = fee.Mul(fee, TRC21GasPrice)
|
||||||
|
} else {
|
||||||
|
fee = fee.Mul(fee, TRC21GasPriceBefore)
|
||||||
}
|
}
|
||||||
|
|
||||||
return fee
|
return fee
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,12 @@ var (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFeeTxWithTRC21Token(t *testing.T) {
|
func TestFeeTxWithTRC21Token(t *testing.T) {
|
||||||
|
oldTRC21GasPriceBefore := new(big.Int).Set(common.TIPTRC21Fee)
|
||||||
|
defer func() {
|
||||||
|
common.TIPTRC21Fee = oldTRC21GasPriceBefore
|
||||||
|
}()
|
||||||
|
common.TRC21GasPriceBefore = big.NewInt(1)
|
||||||
|
|
||||||
// init genesis
|
// init genesis
|
||||||
contractBackend := backends.NewXDCSimulatedBackend(
|
contractBackend := backends.NewXDCSimulatedBackend(
|
||||||
types.GenesisAlloc{
|
types.GenesisAlloc{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue