@@ -246,7 +246,7 @@ type trieGcEntry struct {
246246// NewBlockChain returns a fully initialised block chain using information
247247// available in the database. It initialises the default Ethereum Validator
248248// and Processor.
249- func NewBlockChain (db ethdb.Database , cacheConfig * CacheConfig , genesis * Genesis , overrides * ChainOverrides , engine consensus.Engine , vmConfig vm.Config , shouldPreserve func (header * types.Header ) bool , txLookupLimit * uint64 ) (* BlockChain , error ) {
249+ func NewBlockChain (db ethdb.Database , cacheConfig * CacheConfig , chainConfig * params. ChainConfig , genesis * Genesis , overrides * ChainOverrides , engine consensus.Engine , vmConfig vm.Config , shouldPreserve func (header * types.Header ) bool , txLookupLimit * uint64 ) (* BlockChain , error ) {
250250 if cacheConfig == nil {
251251 cacheConfig = defaultCacheConfig
252252 }
@@ -257,12 +257,23 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
257257 Journal : cacheConfig .TrieCleanJournal ,
258258 Preimages : cacheConfig .Preimages ,
259259 })
260- // Setup the genesis block, commit the provided genesis specification
261- // to database if the genesis block is not present yet, or load the
262- // stored one from database.
263- chainConfig , genesisHash , genesisErr := SetupGenesisBlockWithOverride (db , triedb , genesis , overrides )
264- if _ , ok := genesisErr .(* params.ConfigCompatError ); genesisErr != nil && ! ok {
265- return nil , genesisErr
260+
261+ var genesisHash common.Hash
262+ var genesisErr error
263+
264+ if chainConfig .IsArbitrum () {
265+ genesisHash = rawdb .ReadCanonicalHash (db , chainConfig .ArbitrumChainParams .GenesisBlockNum )
266+ if (genesisHash == common.Hash {}) {
267+ return nil , ErrNoGenesis
268+ }
269+ } else {
270+ // Setup the genesis block, commit the provided genesis specification
271+ // to database if the genesis block is not present yet, or load the
272+ // stored one from database.
273+ chainConfig , genesisHash , genesisErr = SetupGenesisBlockWithOverride (db , triedb , genesis , overrides )
274+ if _ , ok := genesisErr .(* params.ConfigCompatError ); genesisErr != nil && ! ok {
275+ return nil , genesisErr
276+ }
266277 }
267278 log .Info ("" )
268279 log .Info (strings .Repeat ("-" , 153 ))
0 commit comments