Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修改交易费用的计算方式:EffectiveGasPrice标识最终支付的费用不需要区分是否EIP1559 #1

Merged
merged 1 commit into from
Sep 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
"errors"
"fmt"
"math/big"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -78,7 +77,7 @@
var result error
d.resourceCancel()
if err := d.tasks.Wait(); err != nil {
result = errors.Join(result, fmt.Errorf("failed to await deposit %w"), err)

Check failure on line 80 in wallet/deposit.go

View workflow job for this annotation

GitHub Actions / build

fmt.Errorf format %w reads arg #1, but call has 0 args
return result
}
return nil
Expand Down Expand Up @@ -312,17 +311,19 @@
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
Loading