Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashatyrev committed Oct 15, 2024
1 parent 881f39c commit eba5f2a
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,19 @@ void shouldStartSubscriptionsInOptimisticSyncMode() {
verify(subscriptions).startGossip(GENESIS_VALIDATORS_ROOT, true);
}

@Test
void shouldStartSubscriptionsInNonOptimisticSyncModeWhenSyncStateChangedBeforeStart() {
when(recentChainData.isChainHeadOptimistic()).thenReturn(true);

final GossipForkSubscriptions subscriptions = forkAtEpoch(0);
final GossipForkManager manager = managerForForks(subscriptions);

manager.onOptimisticHeadChanged(false);
manager.configureGossipForEpoch(UInt64.ZERO);

verify(subscriptions).startGossip(GENESIS_VALIDATORS_ROOT, false);
}

private GossipForkSubscriptions forkAtEpoch(final long epoch) {
final GossipForkSubscriptions subscriptions =
mock(GossipForkSubscriptions.class, "subscriptionsForEpoch" + epoch);
Expand Down

0 comments on commit eba5f2a

Please sign in to comment.