Skip to content

Commit

Permalink
Adjust log levels and only handle inv requests when chain state is fu…
Browse files Browse the repository at this point in the history
…lly current
  • Loading branch information
lazynina committed Jan 8, 2025
1 parent 0c8606c commit 844a28e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
3 changes: 2 additions & 1 deletion lib/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ func (pp *Peer) HelpHandleInv(msg *MsgDeSoInv) {
func (pp *Peer) HandleInv(msg *MsgDeSoInv) {
// Ignore invs while we're still syncing and before we've requested
// all mempool transactions from one of our peers to bootstrap.
if pp.srv.blockchain.isSyncing() {
//if pp.srv.blockchain.isSyncing() {
if pp.srv.blockchain.chainState() != SyncStateFullyCurrent {
glog.V(1).Infof("Server._handleInv: Ignoring INV while syncing from Peer %v", pp)
return
}
Expand Down
4 changes: 2 additions & 2 deletions lib/pos_mempool_persister.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (mp *MempoolPersister) persistBatchNoLock() error {
return nil
}

glog.V(0).Infof("MempoolPersister: Persisting batch of %d mempool events", len(mp.updateBatch))
glog.V(1).Infof("MempoolPersister: Persisting batch of %d mempool events", len(mp.updateBatch))

// If there are no transactions to persist, return.
if len(mp.updateBatch) == 0 {
Expand Down Expand Up @@ -212,7 +212,7 @@ func (mp *MempoolPersister) persistBatchNoLock() error {

mp.updateBatch = nil

glog.V(0).Infof("MempoolPersister: Persisted %d add events and %d remove events", addEvents, removeEvents)
glog.V(1).Infof("MempoolPersister: Persisted %d add events and %d remove events", addEvents, removeEvents)

return nil
}
Expand Down
17 changes: 9 additions & 8 deletions lib/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1184,14 +1184,15 @@ func (srv *Server) _handleHeaderBundle(pp *Peer, msg *MsgDeSoHeaderBundle) {
len(msg.Headers), srv.blockchain.chainState(), pp,
srv.blockchain.headerTip().Header.Height, printHeight, srv.getCheckpointSyncingStatus(true))))

headerStrings := collections.Transform(msg.Headers, func(header *MsgDeSoHeader) string { return header.ShortString() })
if len(msg.Headers) < 50 {
glog.Infof("Received headers <Height, Hash>:\n %v", strings.Join(headerStrings, "\n"))
} else {
glog.Infof("Received headers <Height, Hash>:\n %v", strings.Join(
append(headerStrings[:10], headerStrings[len(headerStrings)-10:]...), "\n"))
if glog.V(2) {
headerStrings := collections.Transform(msg.Headers, func(header *MsgDeSoHeader) string { return header.ShortString() })
if len(msg.Headers) < 50 {
glog.V(2).Infof("Received headers <Height, Hash>:\n %v", strings.Join(headerStrings, "\n"))
} else {
glog.V(2).Infof("Received headers <Height, Hash>:\n %v", strings.Join(
append(headerStrings[:10], headerStrings[len(headerStrings)-10:]...), "\n"))
}
}

// If we get here, it means that the node is not currently running a Fast-HotStuff
// validator or that the node is syncing. In either case, we sync headers according
// to the blocksync rules.
Expand Down Expand Up @@ -2682,7 +2683,7 @@ func (srv *Server) _handleBlock(pp *Peer, blk *MsgDeSoBlock, isLastBlock bool) {
locator, locatorHeights := srv.blockchain.LatestHeaderLocator()
headerTip := srv.blockchain.headerTip()
currentBlockTip := srv.blockchain.blockTip()
glog.V(0).Infof("Server._handleHeaderBundle: Sending GET_HEADERS message to peer %v\n"+
glog.V(0).Infof("Server._handleBlock: Sending GET_HEADERS message to peer %v\n"+
"Block Locator Hashes & Heights: (%v, %v) and (%v, %v)\n"+
"Header Tip: (%v, %v)\nBlock Tip: (%v, %v)",
pp, locator[0], locatorHeights[0], locator[1], locatorHeights[1], headerTip.Hash, headerTip.Height,
Expand Down

0 comments on commit 844a28e

Please sign in to comment.