Skip to content

Commit

Permalink
set networkID to chainID by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ucwong committed Nov 7, 2023
1 parent 6cf3989 commit 971d81d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions ctxc/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ func New(stack *node.Node, config *Config) (*Cortex, error) {

engine := CreateConsensusEngine(stack, chainConfig, &config.Cuckoo, config.Miner.Notify, config.Miner.Noverify, chainDb)

networkID := config.NetworkId
if networkID == 0 {
networkID = chainConfig.ChainID.Uint64()
}
ctxc := &Cortex{
config: config,
chainDb: chainDb,
Expand All @@ -140,7 +144,7 @@ func New(stack *node.Node, config *Config) (*Cortex, error) {
accountManager: stack.AccountManager(),
engine: engine,
closeBloomHandler: make(chan struct{}),
networkID: config.NetworkId,
networkID: networkID,
gasPrice: config.Miner.GasPrice,
coinbase: config.Coinbase,
bloomRequests: make(chan chan *bloombits.Retrieval),
Expand All @@ -154,7 +158,7 @@ func New(stack *node.Node, config *Config) (*Cortex, error) {
dbVer = fmt.Sprintf("%d", *bcVersion)
}

log.Info("Initialising Cortex protocol", "versions", ProtocolVersions, "network", config.NetworkId, "dbversion", dbVer)
log.Info("Initialising Cortex protocol", "versions", ProtocolVersions, "network", networkID, "dbversion", dbVer)

if !config.SkipBcVersionCheck {
if bcVersion != nil && *bcVersion > core.BlockChainVersion {
Expand Down Expand Up @@ -217,7 +221,7 @@ func New(stack *node.Node, config *Config) (*Cortex, error) {

cacheLimit := cacheConfig.TrieCleanLimit + cacheConfig.TrieDirtyLimit + cacheConfig.SnapshotLimit

if ctxc.protocolManager, err = NewProtocolManager(ctxc.chainConfig, config.SyncMode, config.NetworkId, ctxc.eventMux, ctxc.txPool, ctxc.engine, ctxc.blockchain, chainDb, cacheLimit, config.Whitelist); err != nil {
if ctxc.protocolManager, err = NewProtocolManager(ctxc.chainConfig, config.SyncMode, networkID, ctxc.eventMux, ctxc.txPool, ctxc.engine, ctxc.blockchain, chainDb, cacheLimit, config.Whitelist); err != nil {
return nil, err
}

Expand Down
2 changes: 1 addition & 1 deletion ctxc/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ var DefaultLightGPOConfig = gasprice.Config{
var DefaultConfig = Config{
SyncMode: downloader.FullSync,
Cuckoo: cuckoo.Config{},
NetworkId: 21,
NetworkId: 0,
DatabaseCache: 512,
TrieCleanCache: 154,
TrieCleanCacheJournal: "triecache",
Expand Down

0 comments on commit 971d81d

Please sign in to comment.