1818package core
1919
2020import (
21- "bufio"
2221 "errors"
2322 "fmt"
2423 "io"
25- "math"
2624 "math/big"
27- "os"
2825 "runtime"
29- "strconv"
3026 "strings"
3127 "sync"
3228 "sync/atomic"
@@ -1535,30 +1531,6 @@ func (bc *BlockChain) InsertChain(chain types.Blocks) (int, error) {
15351531 return bc .insertChain (chain , true )
15361532}
15371533
1538- func findVerkleConversionBlock () (uint64 , error ) {
1539- if _ , err := os .Stat ("conversion.txt" ); os .IsNotExist (err ) {
1540- return math .MaxUint64 , nil
1541- }
1542-
1543- f , err := os .Open ("conversion.txt" )
1544- if err != nil {
1545- log .Error ("Failed to open conversion.txt" , "err" , err )
1546- return 0 , err
1547- }
1548- defer f .Close ()
1549-
1550- scanner := bufio .NewScanner (f )
1551- scanner .Scan ()
1552- conversionBlock , err := strconv .ParseUint (scanner .Text (), 10 , 64 )
1553- if err != nil {
1554- log .Error ("Failed to parse conversionBlock" , "err" , err )
1555- return 0 , err
1556- }
1557- log .Info ("Found conversion block info" , "conversionBlock" , conversionBlock )
1558-
1559- return conversionBlock , nil
1560- }
1561-
15621534// insertChain is the internal implementation of InsertChain, which assumes that
15631535// 1) chains are contiguous, and 2) The chain mutex is held.
15641536//
@@ -1573,11 +1545,6 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)
15731545 return 0 , nil
15741546 }
15751547
1576- conversionBlock , err := findVerkleConversionBlock ()
1577- if err != nil {
1578- return 0 , err
1579- }
1580-
15811548 // Start a parallel signature recovery (signer will fluke on fork transition, minimal perf loss)
15821549 SenderCacher .RecoverFromBlocks (types .MakeSigner (bc .chainConfig , chain [0 ].Number (), chain [0 ].Time ()), chain )
15831550
@@ -1767,18 +1734,19 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool) (int, error)
17671734 // is the fork block and that the conversion needs to be marked at started.
17681735 if ! bc .stateCache .InTransition () && ! bc .stateCache .Transitioned () {
17691736 bc .stateCache .StartVerkleTransition (parent .Root , emptyVerkleRoot , bc .Config (), bc .Config ().PragueTime , parent .Root )
1737+ bc .stateCache .SetLastMerkleRoot (parent .Root )
17701738 }
17711739 } else {
17721740 // If the verkle activation time hasn't started, declare it as "not started".
17731741 // This is so that if the miner activates the conversion, the insertion happens
17741742 // in the correct mode.
17751743 bc .stateCache .InitTransitionStatus (false , false )
17761744 }
1777- if parent . Number . Uint64 () == conversionBlock {
1778- bc . StartVerkleTransition ( parent . Root , emptyVerkleRoot , bc . Config (), & parent . Time , parent . Root )
1779- bc . stateCache . SetLastMerkleRoot ( parent . Root )
1745+ stateRoot := parent . Root
1746+ if block . Header (). Number . Uint64 () == 4702178 {
1747+ stateRoot = common . HexToHash ( "0x00" )
17801748 }
1781- statedb , err := state .New (parent . Root , bc .stateCache , bc .snaps )
1749+ statedb , err := state .New (stateRoot , bc .stateCache , bc .snaps )
17821750 if err != nil {
17831751 return it .index , err
17841752 }
0 commit comments