mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-16 18:00:46 +00:00
core: skip AddBalance for special-tx, close XFN-67 (#1629)
This commit is contained in:
parent
d319102837
commit
851bdc45db
1 changed files with 14 additions and 11 deletions
|
|
@ -418,19 +418,22 @@ func (st *StateTransition) TransitionDb(owner common.Address) (*ExecutionResult,
|
||||||
st.refundGas(params.RefundQuotientEIP3529)
|
st.refundGas(params.RefundQuotientEIP3529)
|
||||||
}
|
}
|
||||||
|
|
||||||
if st.evm.Context.BlockNumber.Cmp(common.TIPTRC21Fee) > 0 {
|
// GasPrice of special tx is always 0, so we can skip AddBalance
|
||||||
if (owner != common.Address{}) {
|
if !types.IsSpecialTx(msg.To) {
|
||||||
st.state.AddBalance(owner, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), msg.GasPrice), tracing.BalanceIncreaseRewardTransactionFee)
|
if st.evm.Context.BlockNumber.Cmp(common.TIPTRC21Fee) > 0 {
|
||||||
}
|
if (owner != common.Address{}) {
|
||||||
} else {
|
st.state.AddBalance(owner, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), msg.GasPrice), tracing.BalanceIncreaseRewardTransactionFee)
|
||||||
effectiveTip := msg.GasPrice
|
|
||||||
if st.evm.ChainConfig().IsEIP1559(st.evm.Context.BlockNumber) {
|
|
||||||
effectiveTip = new(big.Int).Sub(msg.GasFeeCap, st.evm.Context.BaseFee)
|
|
||||||
if effectiveTip.Cmp(msg.GasTipCap) > 0 {
|
|
||||||
effectiveTip = msg.GasTipCap
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
effectiveTip := msg.GasPrice
|
||||||
|
if rules.IsEIP1559 {
|
||||||
|
effectiveTip = new(big.Int).Sub(msg.GasFeeCap, st.evm.Context.BaseFee)
|
||||||
|
if effectiveTip.Cmp(msg.GasTipCap) > 0 {
|
||||||
|
effectiveTip = msg.GasTipCap
|
||||||
|
}
|
||||||
|
}
|
||||||
|
st.state.AddBalance(st.evm.Context.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip), tracing.BalanceIncreaseRewardTransactionFee)
|
||||||
}
|
}
|
||||||
st.state.AddBalance(st.evm.Context.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip), tracing.BalanceIncreaseRewardTransactionFee)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return &ExecutionResult{
|
return &ExecutionResult{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue