@@ -248,7 +248,7 @@ func (pm *ProtocolManager) findServers() {
248
248
select {
249
249
case enode := <- enodes :
250
250
if ! added [enode ] {
251
- fmt . Println ("Found LES server:" , enode )
251
+ glog . V ( logger . Info ). Infoln ("Found LES server:" , enode )
252
252
added [enode ] = true
253
253
if node , err := discover .ParseNode (enode ); err == nil {
254
254
pm .p2pServer .AddPeer (node )
@@ -279,9 +279,9 @@ func (pm *ProtocolManager) Start(srvr *p2p.Server) {
279
279
} else {
280
280
if pm .topicDisc != nil {
281
281
go func () {
282
- fmt . Println ("Starting topic register" )
282
+ glog . V ( logger . Debug ). Infoln ("Starting topic register" )
283
283
pm .topicDisc .RegisterTopic (pm .lesTopic , pm .quitSync )
284
- fmt . Println ("Stopped topic register" )
284
+ glog . V ( logger . Debug ). Infoln ("Stopped topic register" )
285
285
}()
286
286
}
287
287
go func () {
@@ -381,7 +381,6 @@ func (pm *ProtocolManager) handle(p *peer) error {
381
381
select {
382
382
case announce := <- p .announceChn :
383
383
p .SendAnnounce (announce )
384
- //fmt.Println(" BROADCAST sent")
385
384
case <- stop :
386
385
return
387
386
}
@@ -392,7 +391,6 @@ func (pm *ProtocolManager) handle(p *peer) error {
392
391
for {
393
392
if err := pm .handleMsg (p ); err != nil {
394
393
glog .V (logger .Debug ).Infof ("%v: message handling failed: %v" , p , err )
395
- //fmt.Println("handleMsg err:", err)
396
394
return err
397
395
}
398
396
}
@@ -412,7 +410,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
412
410
var costs * requestCosts
413
411
var reqCnt , maxReqs int
414
412
415
- //fmt.Println("MSG ", msg.Code, msg.Size)
413
+ glog . V ( logger . Debug ). Infoln ( "msg: " , msg .Code , msg .Size )
416
414
if rc , ok := p .fcCosts [msg .Code ]; ok { // check if msg is a supported request type
417
415
costs = rc
418
416
if p .fcClient == nil {
@@ -441,21 +439,23 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
441
439
// Handle the message depending on its contents
442
440
switch msg .Code {
443
441
case StatusMsg :
444
- glog .V (logger .Debug ).Infof ("LES: received StatusMsg from peer %v" , p .id )
442
+ glog .V (logger .Debug ).Infof ("<=== StatusMsg from peer %v" , p .id )
445
443
// Status messages should never arrive after the handshake
446
444
return errResp (ErrExtraStatusMsg , "uncontrolled status message" )
447
445
448
446
// Block header query, collect the requested headers and reply
449
447
case AnnounceMsg :
448
+ glog .V (logger .Debug ).Infoln ("<=== AnnounceMsg from peer %v:" , p .id )
449
+
450
450
var req announceData
451
451
if err := msg .Decode (& req ); err != nil {
452
452
return errResp (ErrDecode , "%v: %v" , msg , err )
453
453
}
454
- //fmt.Println("RECEIVED ", req.Number, req.Hash, req.Td, req.ReorgDepth)
454
+ glog . V ( logger . Detail ). Infoln ( "AnnounceMsg: " , req .Number , req .Hash , req .Td , req .ReorgDepth )
455
455
pm .fetcher .notify (p , & req )
456
456
457
457
case GetBlockHeadersMsg :
458
- glog .V (logger .Debug ).Infof ("LES: received GetBlockHeadersMsg from peer %v" , p .id )
458
+ glog .V (logger .Debug ).Infof ("<=== GetBlockHeadersMsg from peer %v" , p .id )
459
459
// Decode the complex header query
460
460
var req struct {
461
461
ReqID uint64
@@ -540,7 +540,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
540
540
return errResp (ErrUnexpectedResponse , "" )
541
541
}
542
542
543
- glog .V (logger .Debug ).Infof ("LES: received BlockHeadersMsg from peer %v" , p .id )
543
+ glog .V (logger .Debug ).Infof ("<=== BlockHeadersMsg from peer %v" , p .id )
544
544
// A batch of headers arrived to one of our previous requests
545
545
var resp struct {
546
546
ReqID , BV uint64
@@ -560,7 +560,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
560
560
}
561
561
562
562
case GetBlockBodiesMsg :
563
- glog .V (logger .Debug ).Infof ("LES: received GetBlockBodiesMsg from peer %v" , p .id )
563
+ glog .V (logger .Debug ).Infof ("<=== GetBlockBodiesMsg from peer %v" , p .id )
564
564
// Decode the retrieval message
565
565
var req struct {
566
566
ReqID uint64
@@ -597,7 +597,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
597
597
return errResp (ErrUnexpectedResponse , "" )
598
598
}
599
599
600
- glog .V (logger .Debug ).Infof ("LES: received BlockBodiesMsg from peer %v" , p .id )
600
+ glog .V (logger .Debug ).Infof ("<=== BlockBodiesMsg from peer %v" , p .id )
601
601
// A batch of block bodies arrived to one of our previous requests
602
602
var resp struct {
603
603
ReqID , BV uint64
@@ -614,7 +614,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
614
614
}
615
615
616
616
case GetCodeMsg :
617
- glog .V (logger .Debug ).Infof ("LES: received GetCodeMsg from peer %v" , p .id )
617
+ glog .V (logger .Debug ).Infof ("<=== GetCodeMsg from peer %v" , p .id )
618
618
// Decode the retrieval message
619
619
var req struct {
620
620
ReqID uint64
@@ -658,7 +658,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
658
658
return errResp (ErrUnexpectedResponse , "" )
659
659
}
660
660
661
- glog .V (logger .Debug ).Infof ("LES: received CodeMsg from peer %v" , p .id )
661
+ glog .V (logger .Debug ).Infof ("<=== CodeMsg from peer %v" , p .id )
662
662
// A batch of node state data arrived to one of our previous requests
663
663
var resp struct {
664
664
ReqID , BV uint64
@@ -675,7 +675,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
675
675
}
676
676
677
677
case GetReceiptsMsg :
678
- glog .V (logger .Debug ).Infof ("LES: received GetReceiptsMsg from peer %v" , p .id )
678
+ glog .V (logger .Debug ).Infof ("<=== GetReceiptsMsg from peer %v" , p .id )
679
679
// Decode the retrieval message
680
680
var req struct {
681
681
ReqID uint64
@@ -721,7 +721,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
721
721
return errResp (ErrUnexpectedResponse , "" )
722
722
}
723
723
724
- glog .V (logger .Debug ).Infof ("LES: received ReceiptsMsg from peer %v" , p .id )
724
+ glog .V (logger .Debug ).Infof ("<=== ReceiptsMsg from peer %v" , p .id )
725
725
// A batch of receipts arrived to one of our previous requests
726
726
var resp struct {
727
727
ReqID , BV uint64
@@ -738,7 +738,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
738
738
}
739
739
740
740
case GetProofsMsg :
741
- glog .V (logger .Debug ).Infof ("LES: received GetProofsMsg from peer %v" , p .id )
741
+ glog .V (logger .Debug ).Infof ("<=== GetProofsMsg from peer %v" , p .id )
742
742
// Decode the retrieval message
743
743
var req struct {
744
744
ReqID uint64
@@ -788,7 +788,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
788
788
return errResp (ErrUnexpectedResponse , "" )
789
789
}
790
790
791
- glog .V (logger .Debug ).Infof ("LES: received ProofsMsg from peer %v" , p .id )
791
+ glog .V (logger .Debug ).Infof ("<=== ProofsMsg from peer %v" , p .id )
792
792
// A batch of merkle proofs arrived to one of our previous requests
793
793
var resp struct {
794
794
ReqID , BV uint64
@@ -805,7 +805,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
805
805
}
806
806
807
807
case GetHeaderProofsMsg :
808
- glog .V (logger .Debug ).Infof ("LES: received GetHeaderProofsMsg from peer %v" , p .id )
808
+ glog .V (logger .Debug ).Infof ("<=== GetHeaderProofsMsg from peer %v" , p .id )
809
809
// Decode the retrieval message
810
810
var req struct {
811
811
ReqID uint64
@@ -849,7 +849,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
849
849
return errResp (ErrUnexpectedResponse , "" )
850
850
}
851
851
852
- glog .V (logger .Debug ).Infof ("LES: received HeaderProofsMsg from peer %v" , p .id )
852
+ glog .V (logger .Debug ).Infof ("<=== HeaderProofsMsg from peer %v" , p .id )
853
853
var resp struct {
854
854
ReqID , BV uint64
855
855
Data []ChtResp
@@ -882,7 +882,7 @@ func (pm *ProtocolManager) handleMsg(p *peer) error {
882
882
pm .server .fcCostStats .update (msg .Code , uint64 (reqCnt ), rcost )
883
883
884
884
default :
885
- glog .V (logger .Debug ).Infof ("LES: received unknown message with code %d from peer %v" , msg .Code , p .id )
885
+ glog .V (logger .Debug ).Infof ("<=== unknown message with code %d from peer %v" , msg .Code , p .id )
886
886
return errResp (ErrInvalidMsgCode , "%v" , msg .Code )
887
887
}
888
888
0 commit comments