Skip to content

Commit

Permalink
[stream] elaborate one logger message and updated discover batch to f…
Browse files Browse the repository at this point in the history
…ix local test
  • Loading branch information
JackyWYX committed Feb 23, 2021
1 parent 3466c9d commit e06dad8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/harmony/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ var (
DiscSoftLowCap: 2,
DiscHardLowCap: 2,
DiscHighCap: 1024,
DiscBatch: 2,
DiscBatch: 5,
}

defaultElseSyncConfig = syncConfig{
Expand All @@ -136,7 +136,7 @@ var (
DiscSoftLowCap: 2,
DiscHardLowCap: 2,
DiscHighCap: 1024,
DiscBatch: 2,
DiscBatch: 5,
}
)

Expand Down
6 changes: 5 additions & 1 deletion hmy/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,11 @@ func (d *Downloader) loop() {
}()
continue
}
d.logger.Info().Bool("initSync", initSync).Msg("sync finished")
d.logger.Info().Int("block added", addedBN).
Uint64("current height", d.bc.CurrentBlock().NumberU64()).
Bool("initSync", initSync).
Uint32("shard", d.bc.ShardID()).
Msg("sync finished")

if addedBN != 0 {
// If block number has been changed, trigger another sync
Expand Down
2 changes: 1 addition & 1 deletion hmy/downloader/shortrange.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (d *Downloader) doShortRangeSync() (int, error) {
sh.removeStreams(whitelist)
return n, errors.Wrap(err, "InsertChain")
}
return n, nil
return len(blocks), nil
}

type srHelper struct {
Expand Down
3 changes: 3 additions & 0 deletions p2p/stream/protocols/sync/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func (p *Protocol) wrapStream(raw libp2p_network.Stream) *syncStream {
}

func (st *syncStream) run() {
st.logger.Info().Str("StreamID", string(st.ID())).Msg("running sync protocol on stream")
defer st.logger.Info().Str("StreamID", string(st.ID())).Msg("end running sync protocol on stream")

go st.handleReqLoop()
go st.handleRespLoop()
st.readMsgLoop()
Expand Down

0 comments on commit e06dad8

Please sign in to comment.