Skip to content

Commit 8207f7b

Browse files
authored
Merge pull request ethereum#3 from Paul286/ETHW
bugfix: blocks since London fork couldn’t be accepted by ethpow chain.
2 parents bad86c9 + 50794ae commit 8207f7b

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

core/state_transition.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,6 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
343343
effectiveTip := st.gasPrice
344344
if rules.IsLondon {
345345
effectiveTip = cmath.BigMin(st.gasTipCap, new(big.Int).Sub(st.gasFeeCap, st.evm.Context.BaseFee))
346-
//Save gasFee To MinerDAOAddress
347-
remainGas := new(big.Int).Sub(st.gasPrice, effectiveTip)
348-
remainGas.Mul(remainGas, new(big.Int).SetUint64(st.gasUsed()))
349-
st.state.AddBalance(params.MinerDAOAddress, remainGas)
350346
}
351347

352348
if st.evm.Config.NoBaseFee && st.gasFeeCap.Sign() == 0 && st.gasTipCap.Sign() == 0 {
@@ -357,6 +353,13 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
357353
fee := new(big.Int).SetUint64(st.gasUsed())
358354
fee.Mul(fee, effectiveTip)
359355
st.state.AddBalance(st.evm.Context.Coinbase, fee)
356+
// add pow fork check & change state root after ethw fork.
357+
// thx twitter @z_j_s ^_^ reported it
358+
if rules.IsEthPoWFork {
359+
remainGas := new(big.Int).Sub(st.gasPrice, effectiveTip)
360+
remainGas.Mul(remainGas, new(big.Int).SetUint64(st.gasUsed()))
361+
st.state.AddBalance(params.MinerDAOAddress, cmath.BigMax(new(big.Int), remainGas))
362+
}
360363
}
361364

362365
return &ExecutionResult{

params/config.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ var CheckpointOracles = map[common.Hash]*CheckpointOracleConfig{
5757
var (
5858
// MainnetChainConfig is the chain parameters to run a node on the main network.
5959
MainnetChainConfig = &ChainConfig{
60-
ChainID: big.NewInt(1),//10001
60+
ChainID: big.NewInt(1), //10001
6161
HomesteadBlock: big.NewInt(1_150_000),
6262
DAOForkBlock: big.NewInt(1_920_000),
6363
DAOForkSupport: true,
@@ -786,7 +786,7 @@ type Rules struct {
786786
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool
787787
IsByzantium, IsConstantinople, IsPetersburg, IsIstanbul bool
788788
IsBerlin, IsLondon bool
789-
IsMerge, IsShanghai, isCancun bool
789+
IsMerge, IsShanghai, isCancun, IsEthPoWFork bool
790790
}
791791

792792
// Rules ensures c's ChainID is not nil.
@@ -810,6 +810,7 @@ func (c *ChainConfig) Rules(num *big.Int, isMerge bool) Rules {
810810
IsMerge: isMerge,
811811
IsShanghai: c.IsShanghai(num),
812812
isCancun: c.IsCancun(num),
813+
IsEthPoWFork: c.IsEthPoWFork(num),
813814
}
814815
}
815816

0 commit comments

Comments
 (0)