@@ -183,8 +183,7 @@ func main() {
183
183
type GossipMsgType int16
184
184
185
185
const (
186
- GSM_signedObservation GossipMsgType = iota
187
- GSM_signedObservationInBatch
186
+ GSM_signedObservationInBatch GossipMsgType = iota
188
187
GSM_signedObservationBatch
189
188
GSM_tbObservation
190
189
GSM_signedHeartbeat
@@ -196,7 +195,6 @@ func main() {
196
195
)
197
196
198
197
// Inbound observations
199
- obsvC := make (chan * node_common.MsgWithTimeStamp [gossipv1.SignedObservation ], 20000 )
200
198
batchObsvC := make (chan * node_common.MsgWithTimeStamp [gossipv1.SignedObservationBatch ], 20000 )
201
199
202
200
// Inbound observation requests
@@ -266,12 +264,12 @@ func main() {
266
264
267
265
gossipMsgTable := table .NewWriter ()
268
266
gossipMsgTable .SetOutputMirror (os .Stdout )
269
- gossipMsgTable .AppendHeader (table.Row {"#" , "Guardian" , "Obsv" , " ObsvInB" , "ObsvB" , "TB_OBsv" , "HB" , "VAA" , "Obsv_Req" , "Chain_Gov_Cfg" , "Chain_Gov_Status" })
267
+ gossipMsgTable .AppendHeader (table.Row {"#" , "Guardian" , "ObsvInB" , "ObsvB" , "TB_OBsv" , "HB" , "VAA" , "Obsv_Req" , "Chain_Gov_Cfg" , "Chain_Gov_Status" })
270
268
gossipMsgTable .SetStyle (table .StyleColoredDark )
271
269
272
270
obsvRateTable := table .NewWriter ()
273
271
obsvRateTable .SetOutputMirror (os .Stdout )
274
- obsvRateTable .AppendHeader (table.Row {"#" , "Guardian" , "Obsv" , " 1%" , "2%" , "3%" , "4%" , "5%" , "6%" , "7%" , "8%" , "9%" , "10%" })
272
+ obsvRateTable .AppendHeader (table.Row {"#" , "Guardian" , "1%" , "2%" , "3%" , "4%" , "5%" , "6%" , "7%" , "8%" , "9%" , "10%" })
275
273
obsvRateTable .SetStyle (table .StyleColoredDark )
276
274
277
275
guardianTable := table .NewWriter ()
@@ -338,41 +336,11 @@ func main() {
338
336
339
337
// Just count observations
340
338
go func () {
341
- uniqueObs := map [string ]struct {}{}
342
339
uniqueObsInBatch := map [string ]struct {}{}
343
340
for {
344
341
select {
345
342
case <- rootCtx .Done ():
346
343
return
347
- case o := <- obsvC : // TODO: Rip out this code once we cut over to batching.
348
- spl := strings .Split (o .Msg .MessageId , "/" )
349
- emitter := strings .ToLower (spl [1 ])
350
- addr := "0x" + string (hex .EncodeToString (o .Msg .Addr ))
351
- idx := guardianIndexMap [strings .ToLower (addr )]
352
- if knownEmitters [emitter ] {
353
- gossipCounter [idx ][GSM_tbObservation ]++
354
- gossipCounter [totalsRow ][GSM_tbObservation ]++
355
- }
356
- if handleObsv (uint (idx )) {
357
- obsvRateTable .ResetRows ()
358
- for i := 0 ; i < numGuardians ; i ++ {
359
- obsvRateTable .AppendRow (table.Row {i , obsvRateRows [int (i )].guardianName , obsvRateRows [int (i )].obsvCount , obsvRateRows [uint (i )].percents [0 ], obsvRateRows [uint (i )].percents [1 ], obsvRateRows [uint (i )].percents [2 ], obsvRateRows [uint (i )].percents [3 ], obsvRateRows [uint (i )].percents [4 ], obsvRateRows [uint (i )].percents [5 ], obsvRateRows [uint (i )].percents [6 ], obsvRateRows [uint (i )].percents [7 ], obsvRateRows [uint (i )].percents [8 ], obsvRateRows [uint (i )].percents [9 ]})
360
- }
361
- }
362
- gossipCounter [idx ][GSM_signedObservation ]++
363
- gossipCounter [totalsRow ][GSM_signedObservation ]++
364
-
365
- if * loadTesting {
366
- uniqueObs [hex .EncodeToString (o .Msg .Hash )] = struct {}{}
367
- gossipCounter [uniqueRow ][GSM_signedObservation ] = len (uniqueObs )
368
- }
369
-
370
- gossipLock .Lock ()
371
- gossipMsgTable .ResetRows ()
372
- for idx , r := range gossipCounter {
373
- gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ], r [8 ]})
374
- }
375
- gossipLock .Unlock ()
376
344
case batch := <- batchObsvC :
377
345
addr := "0x" + string (hex .EncodeToString (batch .Msg .Addr ))
378
346
idx := guardianIndexMap [strings .ToLower (addr )]
@@ -406,7 +374,7 @@ func main() {
406
374
gossipLock .Lock ()
407
375
gossipMsgTable .ResetRows ()
408
376
for idx , r := range gossipCounter {
409
- gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ], r [ 8 ] })
377
+ gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ]})
410
378
}
411
379
gossipLock .Unlock ()
412
380
}
@@ -428,7 +396,7 @@ func main() {
428
396
gossipLock .Lock ()
429
397
gossipMsgTable .ResetRows ()
430
398
for idx , r := range gossipCounter {
431
- gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ], r [ 8 ] })
399
+ gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ]})
432
400
}
433
401
gossipLock .Unlock ()
434
402
}
@@ -460,7 +428,7 @@ func main() {
460
428
gossipLock .Lock ()
461
429
gossipMsgTable .ResetRows ()
462
430
for idx , r := range gossipCounter {
463
- gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ], r [ 8 ] })
431
+ gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ]})
464
432
}
465
433
gossipLock .Unlock ()
466
434
}
@@ -529,7 +497,7 @@ func main() {
529
497
gossipLock .Lock ()
530
498
gossipMsgTable .ResetRows ()
531
499
for idx , r := range gossipCounter {
532
- gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ], r [ 8 ] })
500
+ gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ]})
533
501
}
534
502
gossipLock .Unlock ()
535
503
if activeTable == 0 {
@@ -564,7 +532,7 @@ func main() {
564
532
gossipLock .Lock ()
565
533
gossipMsgTable .ResetRows ()
566
534
for idx , r := range gossipCounter {
567
- gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ], r [ 8 ] })
535
+ gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ]})
568
536
}
569
537
gossipLock .Unlock ()
570
538
}
@@ -585,7 +553,7 @@ func main() {
585
553
gossipLock .Lock ()
586
554
gossipMsgTable .ResetRows ()
587
555
for idx , r := range gossipCounter {
588
- gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ], r [ 8 ] })
556
+ gossipMsgTable .AppendRow (table.Row {idx , guardianIndexToNameMap [idx ], r [0 ], r [1 ], r [2 ], r [3 ], r [4 ], r [5 ], r [6 ], r [7 ]})
589
557
}
590
558
gossipLock .Unlock ()
591
559
}
@@ -610,7 +578,6 @@ func main() {
610
578
gst ,
611
579
rootCtxCancel ,
612
580
p2p .WithComponents (components ),
613
- p2p .WithSignedObservationListener (obsvC ),
614
581
p2p .WithSignedObservationBatchListener (batchObsvC ),
615
582
p2p .WithSignedVAAListener (signedInC ),
616
583
p2p .WithObservationRequestListener (obsvReqC ),
0 commit comments