Skip to content

Commit

Permalink
Fixed bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
Frozen committed Jul 4, 2024
1 parent e0645a1 commit 55045c9
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ trace-pointer:

debug:
rm -rf .dht-127.0.0.1*
# uncomment the following lines to enable debug logging for libp2p, it produces a lot of logs, so disabled by default
#export GOLOG_LOG_LEVEL=debug
#export GOLOG_OUTPUT=stdout
bash ./test/debug.sh

debug-kill:
Expand Down
2 changes: 1 addition & 1 deletion cmd/bootnode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func main() {
utils.FatalErrMsg(err, "cannot initialize network")
}

fmt.Printf("bootnode BN_MA=%s",
fmt.Printf("bootnode BN_MA=%s\n",
fmt.Sprintf("/ip4/%s/tcp/%s/p2p/%s", *ip, *port, host.GetID().String()),
)

Expand Down
2 changes: 1 addition & 1 deletion node/node_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ func (node *Node) BootstrapConsensus() error {
if numPeersNow >= min {
utils.Logger().Info().Msg("[bootstrap] StartConsensus")
enoughMinPeers <- struct{}{}
fmt.Println("Bootstrap consensus done.", numPeersNow, " peers are connected")
fmt.Printf("Bootstrap consensus done.%d peers are connected shard: %d\n", numPeersNow, node.Consensus.ShardID)
return
}
utils.Logger().Info().
Expand Down
4 changes: 2 additions & 2 deletions p2p/discovery/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ func (opt DHTConfig) GetLibp2pRawOptions() ([]libp2p_dht.Option, error) {

bootOption, err := getBootstrapOption(opt.BootNodes)
if err != nil {
return nil, err
return nil, errors.WithMessage(err, "failed to get bootstrap option")
}
opts = append(opts, bootOption)

if opt.DataStoreFile != nil && len(*opt.DataStoreFile) != 0 {
dsOption, err := getDataStoreOption(*opt.DataStoreFile)
if err != nil {
return nil, err
return nil, errors.WithMessage(err, "failed to get data store option")
}
opts = append(opts, dsOption)
}
Expand Down
4 changes: 2 additions & 2 deletions p2p/stream/common/requestmanager/requestmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ func (rm *requestManager) refreshStreams() {
added, removed := checkStreamUpdates(rm.streams, rm.sm.GetStreams())

for _, st := range added {
rm.logger.Info().Str("streamID", string(st.ID())).Msg("add new stream")
rm.logger.Info().Str("streamID", string(st.ID())).Msg("adding new stream")
rm.addNewStream(st)
}
for _, st := range removed {
rm.logger.Info().Str("streamID", string(st.ID())).Msg("remove stream")
rm.logger.Info().Str("streamID", string(st.ID())).Msg("removing stream")
rm.removeStream(st)
}
}
Expand Down
4 changes: 2 additions & 2 deletions rpc/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func startWS(apis []rpc.API, rmf *rpc.RpcMethodFilter) (err error) {

utils.Logger().Info().
Str("url", fmt.Sprintf("ws://%s", wsListener.Addr())).
Msg("WebSocket endpoint opened")
Msg("WebSocket WS endpoint opened")
fmt.Printf("Started WS server at: %v\n", wsEndpoint)
return nil
}
Expand All @@ -269,7 +269,7 @@ func startAuthWS(apis []rpc.API, rmf *rpc.RpcMethodFilter) (err error) {

utils.Logger().Info().
Str("url", fmt.Sprintf("ws://%s", wsListener.Addr())).
Msg("WebSocket endpoint opened")
Msg("WebSocket Auth-WS endpoint opened")
fmt.Printf("Started Auth-WS server at: %v\n", wsAuthEndpoint)
return nil
}

0 comments on commit 55045c9

Please sign in to comment.