Skip to content

Commit 546ffc1

Browse files
committed
gui: throttle peer stake updates
1 parent bc471c6 commit 546ffc1

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

src/disco/gui/fd_gui_peers.c

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -460,20 +460,22 @@ static int
460460
fd_gui_peers_contact_info_eq( fd_contact_info_t const * ci1,
461461
fd_contact_info_t const * ci2 ) {
462462
int ci_eq =
463-
ci1->shred_version == ci2->shred_version
464-
&& ci1->instance_creation_wallclock_nanos== ci2->instance_creation_wallclock_nanos
463+
// ci1->shred_version == ci2->shred_version
464+
// && ci1->instance_creation_wallclock_nanos== ci2->instance_creation_wallclock_nanos
465465
// && ci1->wallclock_nanos == ci2->wallclock_nanos
466-
&& ci1->version.client == ci2->version.client
466+
ci1->version.client == ci2->version.client
467467
&& ci1->version.major == ci2->version.major
468468
&& ci1->version.minor == ci2->version.minor
469-
&& ci1->version.patch == ci2->version.patch
470-
&& ci1->version.commit == ci2->version.commit
471-
&& ci1->version.feature_set == ci2->version.feature_set;
469+
&& ci1->version.patch == ci2->version.patch;
470+
// && ci1->version.commit == ci2->version.commit
471+
// && ci1->version.feature_set == ci2->version.feature_set;
472472

473473
if( FD_LIKELY( !ci_eq ) ) return 0;
474-
for( ulong j=0UL; j<(FD_CONTACT_INFO_SOCKET_CNT); j++ ) {
475-
if( FD_LIKELY( !(ci1->sockets[ j ].addr==ci2->sockets[ j ].addr && ci1->sockets[ j ].port==ci2->sockets[ j ].port) ) ) return 0;
476-
}
474+
// for( ulong j=0UL; j<(FD_CONTACT_INFO_SOCKET_CNT); j++ ) {
475+
// if( FD_LIKELY( !(ci1->sockets[ j ].addr==ci2->sockets[ j ].addr && ci1->sockets[ j ].port==ci2->sockets[ j ].port) ) ) return 0;
476+
// }
477+
if( FD_LIKELY( !(ci1->sockets[ FD_CONTACT_INFO_SOCKET_TVU ].addr==ci2->sockets[ FD_CONTACT_INFO_SOCKET_TVU ].addr && ci1->sockets[ FD_CONTACT_INFO_SOCKET_TVU ].port==ci2->sockets[ FD_CONTACT_INFO_SOCKET_TVU ].port) ) ) return 0;
478+
477479
return 1;
478480
}
479481

@@ -789,6 +791,10 @@ fd_gui_peers_handle_vote_update( fd_gui_peers_ctx_t * peers,
789791

790792
fd_gui_peers_node_t * peer = peers->contact_info_table + peer_idx;
791793

794+
/* Shard vote updates over a 10 second period. This prevents a huge
795+
spike in stake updates the first time during startup. */
796+
if( (((ulong)now % (ulong)(10UL*1e9)) / (ulong)1e9) != (i % 10) ) continue;
797+
792798
/* TODO: we only publish updates when stake changes, otherwise we'd
793799
have to republish for every peer every slot, which ends up being
794800
too much bandwidth because we republish all the peer info.

0 commit comments

Comments
 (0)