diff --git a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java index a52e1cfb1b..a6c37951f7 100644 --- a/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java +++ b/ethereum/eth/src/main/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActions.java @@ -82,7 +82,7 @@ public CompletableFuture waitForSuitablePeers(final FastSyncState if (ethContext.getEthPeers().availablePeerCount() > 0) { LOG.warn( "Fast sync timed out before minimum peer count was reached. Continuing with reduced peers."); - result.complete(null); + result.complete(fastSyncState); } else { LOG.warn( "Maximum wait time for fast sync reached but no peers available. Continuing to wait for any available peer."); @@ -98,7 +98,7 @@ public CompletableFuture waitForSuitablePeers(final FastSyncState LOG.error("Failed to find peers for fast sync", error); result.completeExceptionally(error); } else { - result.complete(null); + result.complete(fastSyncState); } return null; }); diff --git a/ethereum/eth/src/test/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActionsTest.java b/ethereum/eth/src/test/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActionsTest.java index 635cca91c5..9c32065ab2 100644 --- a/ethereum/eth/src/test/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActionsTest.java +++ b/ethereum/eth/src/test/java/tech/pegasys/pantheon/ethereum/eth/sync/fastsync/FastSyncActionsTest.java @@ -93,14 +93,15 @@ public void waitForPeersShouldSucceedIfEnoughPeersAreFound() { } final CompletableFuture result = fastSyncActions.waitForSuitablePeers(EMPTY_SYNC_STATE); - assertThat(result).isCompleted(); + assertThat(result).isCompletedWithValue(EMPTY_SYNC_STATE); } @Test public void waitForPeersShouldReportSuccessWhenTimeLimitReachedAndAPeerIsAvailable() { EthProtocolManagerTestUtil.createPeer(ethProtocolManager); timeoutCount.set(Integer.MAX_VALUE); - assertThat(fastSyncActions.waitForSuitablePeers(EMPTY_SYNC_STATE)).isCompleted(); + assertThat(fastSyncActions.waitForSuitablePeers(EMPTY_SYNC_STATE)) + .isCompletedWithValue(EMPTY_SYNC_STATE); } @Test @@ -111,7 +112,7 @@ public void waitForPeersShouldContinueWaitingUntilAtLeastOnePeerIsAvailable() { assertThat(result).isNotCompleted(); EthProtocolManagerTestUtil.createPeer(ethProtocolManager); - assertThat(result).isCompleted(); + assertThat(result).isCompletedWithValue(EMPTY_SYNC_STATE); } @Test