Skip to content

Commit

Permalink
修改交易费用的计算方式:EffectiveGasPrice标识最终支付的费用不需要区分是否EIP1559 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pdayburt authored Sep 10, 2024
1 parent 353090e commit 040344b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions wallet/deposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"errors"
"fmt"
"math/big"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -312,17 +311,19 @@ func (d *Deposit) processTransactions(txList []node.TransactionList, baseFee str
continue
}
var gasPrice *big.Int
var transactionFee *big.Int
var transactionFee = big.NewInt(0)
if (addressTo != nil && txReceipt.Status == 1) || (ccTx != nil && txReceipt.Status == 1) || (withdraw != nil && txReceipt.Status == 1) {
if txReceipt.Type == types.DynamicFeeTxType {
/*if txReceipt.Type == types.DynamicFeeTxType {
gasPrice = txReceipt.EffectiveGasPrice
baseFeeInt, _ := strconv.ParseInt(baseFee, 10, 64)
transactionFee = new(big.Int).Add(gasPrice, big.NewInt(baseFeeInt))
transactionFee.Mul(transactionFee, new(big.Int).SetUint64(txReceipt.GasUsed))
} else {
gasPrice = txReceipt.EffectiveGasPrice
transactionFee = new(big.Int).Mul(gasPrice, new(big.Int).SetUint64(txReceipt.GasUsed))
}
}*/
gasPrice = txReceipt.EffectiveGasPrice
transactionFee.Mul(gasPrice, big.NewInt(int64(txReceipt.GasUsed)))

// 充值:to 是系统用户地址, from 地址是外部地址
if addressTo != nil && txReceipt.Status == 1 && addressFrom == nil {
Expand Down

0 comments on commit 040344b

Please sign in to comment.