Add additional loggin when starting node

This commit is contained in:
ChronosX88 2021-04-19 22:35:40 +03:00
parent 1b5f9a0d30
commit acf6a5cdcb
Signed by: ChronosXYZ
GPG Key ID: 085A69A82C8C511A

View File

@ -79,6 +79,7 @@ func NewNode(config *config.Config, prvKey crypto.PrivKey, pexDiscoveryUpdateTim
logrus.Fatal(err) logrus.Fatal(err)
} }
n.Host = lhost n.Host = lhost
logrus.Info("Started up Libp2p host!")
// initialize ethereum client // initialize ethereum client
ethClient, err := provideEthereumClient(n.Config) ethClient, err := provideEthereumClient(n.Config)
@ -86,16 +87,19 @@ func NewNode(config *config.Config, prvKey crypto.PrivKey, pexDiscoveryUpdateTim
logrus.Fatal(err) logrus.Fatal(err)
} }
n.Ethereum = ethClient n.Ethereum = ethClient
logrus.Info("Started up Ethereum client!")
// initialize blockchain rpc clients // initialize blockchain rpc clients
err = n.setupRPCClients() err = n.setupRPCClients()
if err != nil { if err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }
logrus.Info("RPC clients has successfully configured!")
// initialize pubsub subsystem // initialize pubsub subsystem
psb := providePubsubRouter(lhost, n.Config) psb := providePubsubRouter(lhost, n.Config)
n.PubSubRouter = psb n.PubSubRouter = psb
logrus.Info("PubSub subsystem has initialized!")
// initialize peer discovery // initialize peer discovery
peerDiscovery, err := providePeerDiscovery(n.Config, lhost, pexDiscoveryUpdateTime) peerDiscovery, err := providePeerDiscovery(n.Config, lhost, pexDiscoveryUpdateTime)
@ -103,6 +107,7 @@ func NewNode(config *config.Config, prvKey crypto.PrivKey, pexDiscoveryUpdateTim
logrus.Fatal(err) logrus.Fatal(err)
} }
n.PeerDiscovery = peerDiscovery n.PeerDiscovery = peerDiscovery
logrus.Info("Peer discovery subsystem has initialized!")
// get private key of libp2p host // get private key of libp2p host
rawPrivKey, err := prvKey.Raw() rawPrivKey, err := prvKey.Raw()
@ -116,18 +121,22 @@ func NewNode(config *config.Config, prvKey crypto.PrivKey, pexDiscoveryUpdateTim
logrus.Fatal(err) logrus.Fatal(err)
} }
n.Beacon = randomBeaconNetwork n.Beacon = randomBeaconNetwork
logrus.Info("Random beacon subsystem has initialized!")
// initialize mining subsystem // initialize mining subsystem
miner := provideMiner(n.Host.ID(), *n.Ethereum.GetEthAddress(), n.Beacon, n.Ethereum, rawPrivKey) miner := provideMiner(n.Host.ID(), *n.Ethereum.GetEthAddress(), n.Beacon, n.Ethereum, rawPrivKey)
n.Miner = miner n.Miner = miner
logrus.Info("Mining subsystem has initialized!")
// initialize event log cache subsystem // initialize event log cache subsystem
eventCache := provideEventCache(config) eventCache := provideEventCache(config)
n.EventCache = eventCache n.EventCache = eventCache
logrus.Info("Event cache subsystem has initialized!")
// initialize consensus subsystem // initialize consensus subsystem
cManager := provideConsensusManager(psb, miner, ethClient, rawPrivKey, n.Config.ConsensusMinApprovals, eventCache) cManager := provideConsensusManager(psb, miner, ethClient, rawPrivKey, n.Config.ConsensusMinApprovals, eventCache)
n.ConsensusManager = cManager n.ConsensusManager = cManager
logrus.Info("Consensus subsystem has initialized!")
// initialize dispute subsystem // initialize dispute subsystem
disputeManager, err := provideDisputeManager(context.TODO(), ethClient, cManager) disputeManager, err := provideDisputeManager(context.TODO(), ethClient, cManager)
@ -135,6 +144,7 @@ func NewNode(config *config.Config, prvKey crypto.PrivKey, pexDiscoveryUpdateTim
logrus.Fatal(err) logrus.Fatal(err)
} }
n.DisputeManager = disputeManager n.DisputeManager = disputeManager
logrus.Info("Dispute subsystem has initialized!")
// initialize internal eth wallet // initialize internal eth wallet
wallet, err := provideWallet(n.Host.ID(), rawPrivKey) wallet, err := provideWallet(n.Host.ID(), rawPrivKey)