@Test void shouldUpdatePeerChainWhenStatusUpdates() { tracker.subscribeToTargetChainUpdates(updatedChainsSubscriber); connectPeer(peer); updateStatus(peer, status); final TargetChain finalizedChain = chainWith( new SlotAndBlockRoot( compute_start_slot_at_epoch(status.getFinalizedEpoch()), status.getFinalizedRoot()), syncSource); final TargetChain nonfinalizedChain = chainWith(new SlotAndBlockRoot(status.getHeadSlot(), status.getHeadRoot()), syncSource); assertThat(finalizedChains.streamChains()).containsExactly(finalizedChain); assertThat(nonfinalizedChains.streamChains()).containsExactly(nonfinalizedChain); verify(updatedChainsSubscriber).run(); }
public void subscribeToTargetChainUpdates(final Runnable subscriber) { chainsUpdatedSubscribers.subscribe(subscriber); }
PeerChainTracker { public void subscribeToTargetChainUpdates(final Runnable subscriber) { chainsUpdatedSubscribers.subscribe(subscriber); } }
PeerChainTracker { public void subscribeToTargetChainUpdates(final Runnable subscriber) { chainsUpdatedSubscribers.subscribe(subscriber); } PeerChainTracker(
      final EventThread eventThread,
      final P2PNetwork<Eth2Peer> p2pNetwork,
      final SyncSourceFactory syncSourceFactory,
      final TargetChains finalizedChains,
      final TargetChains nonfinalizedChains); }
PeerChainTracker { public void subscribeToTargetChainUpdates(final Runnable subscriber) { chainsUpdatedSubscribers.subscribe(subscriber); } PeerChainTracker(
      final EventThread eventThread,
      final P2PNetwork<Eth2Peer> p2pNetwork,
      final SyncSourceFactory syncSourceFactory,
      final TargetChains finalizedChains,
      final TargetChains nonfinalizedChains); void start(); void stop(); void subscribeToTargetChainUpdates(final Runnable subscriber); }
PeerChainTracker { public void subscribeToTargetChainUpdates(final Runnable subscriber) { chainsUpdatedSubscribers.subscribe(subscriber); } PeerChainTracker(
      final EventThread eventThread,
      final P2PNetwork<Eth2Peer> p2pNetwork,
      final SyncSourceFactory syncSourceFactory,
      final TargetChains finalizedChains,
      final TargetChains nonfinalizedChains); void start(); void stop(); void subscribeToTargetChainUpdates(final Runnable subscriber);  }