From c396fb5ad92644c92c0586971c0c8fe8a64e2e19 Mon Sep 17 00:00:00 2001 From: Matilda Clerke Date: Thu, 17 Oct 2024 14:15:56 +1100 Subject: [PATCH] 7311: Update GetReceiptsFromPeerTask with partialSuccess changes Signed-off-by: Matilda Clerke --- .../manager/peertask/task/GetReceiptsFromPeerTask.java | 4 ++-- .../peertask/task/GetReceiptsFromPeerTaskTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java index 802148b115..afa4fecf96 100644 --- a/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java +++ b/ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java @@ -116,7 +116,7 @@ public class GetReceiptsFromPeerTask } @Override - public boolean isPartialSuccess(final Map> result) { - return result.isEmpty(); + public boolean isSuccess(final Map> result) { + return !result.isEmpty(); } } diff --git a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java index a06ec3a751..18c5d803e3 100644 --- a/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java +++ b/ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java @@ -158,22 +158,22 @@ public class GetReceiptsFromPeerTaskTest { } @Test - public void testIsPartialSuccessForPartialSuccess() { + public void testIsSuccessForPartialSuccess() { GetReceiptsFromPeerTask task = new GetReceiptsFromPeerTask(Collections.emptyList(), null, () -> null); - Assertions.assertTrue(task.isPartialSuccess(Collections.emptyMap())); + Assertions.assertFalse(task.isSuccess(Collections.emptyMap())); } @Test - public void testIsPartialSuccessForFullSuccess() { + public void testIsSuccessForFullSuccess() { GetReceiptsFromPeerTask task = new GetReceiptsFromPeerTask(Collections.emptyList(), null, () -> null); Map> map = new HashMap<>(); map.put(mockBlockHeader(1), null); - Assertions.assertFalse(task.isPartialSuccess(map)); + Assertions.assertTrue(task.isSuccess(map)); } private BlockHeader mockBlockHeader(final long blockNumber) {