From 844a28ed48e6527085187383fab915fed7572601 Mon Sep 17 00:00:00 2001 From: Lazy Nina Date: Wed, 8 Jan 2025 14:26:51 -0500 Subject: [PATCH] Adjust log levels and only handle inv requests when chain state is fully current --- lib/peer.go | 3 ++- lib/pos_mempool_persister.go | 4 ++-- lib/server.go | 17 +++++++++-------- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/peer.go b/lib/peer.go index 517bed0ea..aee7bbc67 100644 --- a/lib/peer.go +++ b/lib/peer.go @@ -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 } diff --git a/lib/pos_mempool_persister.go b/lib/pos_mempool_persister.go index 593aede42..43ee7c449 100644 --- a/lib/pos_mempool_persister.go +++ b/lib/pos_mempool_persister.go @@ -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 { @@ -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 } diff --git a/lib/server.go b/lib/server.go index 7c5591e84..45235a5fd 100644 --- a/lib/server.go +++ b/lib/server.go @@ -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 :\n %v", strings.Join(headerStrings, "\n")) - } else { - glog.Infof("Received headers :\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 :\n %v", strings.Join(headerStrings, "\n")) + } else { + glog.V(2).Infof("Received headers :\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. @@ -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,