core: skip AddBalance for special-tx, close XFN-67 (#1629)

This commit is contained in:
Daniel Liu 2025-11-14 19:02:21 +08:00 committed by benjamin202410
parent bb875a4659
commit a4190a0c63

View file

@ -384,13 +384,15 @@ func (st *StateTransition) TransitionDb(owner common.Address) (*ExecutionResult,
st.refundGas(params.RefundQuotientEIP3529)
}
// GasPrice of special tx is always 0, so we can skip AddBalance
if !types.IsSpecialTx(msg.To()) {
if st.evm.Context.BlockNumber.Cmp(common.TIPTRC21Fee) > 0 {
if (owner != common.Address{}) {
st.state.AddBalance(owner, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.gasPrice))
}
} else {
effectiveTip := st.gasPrice
if st.evm.ChainConfig().IsEIP1559(st.evm.Context.BlockNumber) {
if rules.IsEIP1559 {
effectiveTip = new(big.Int).Sub(st.gasFeeCap, st.evm.Context.BaseFee)
if effectiveTip.Cmp(st.gasTipCap) > 0 {
effectiveTip = st.gasTipCap
@ -398,6 +400,7 @@ func (st *StateTransition) TransitionDb(owner common.Address) (*ExecutionResult,
}
st.state.AddBalance(st.evm.Context.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), effectiveTip))
}
}
return &ExecutionResult{
UsedGas: st.gasUsed(),