7311: Update GetReceiptsFromPeerTask with partialSuccess changes

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
pull/7638/head
Matilda Clerke 1 month ago
parent 4f4b0910a1
commit c396fb5ad9
  1. 4
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTask.java
  2. 8
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/manager/peertask/task/GetReceiptsFromPeerTaskTest.java

@ -116,7 +116,7 @@ public class GetReceiptsFromPeerTask
} }
@Override @Override
public boolean isPartialSuccess(final Map<BlockHeader, List<TransactionReceipt>> result) { public boolean isSuccess(final Map<BlockHeader, List<TransactionReceipt>> result) {
return result.isEmpty(); return !result.isEmpty();
} }
} }

@ -158,22 +158,22 @@ public class GetReceiptsFromPeerTaskTest {
} }
@Test @Test
public void testIsPartialSuccessForPartialSuccess() { public void testIsSuccessForPartialSuccess() {
GetReceiptsFromPeerTask task = GetReceiptsFromPeerTask task =
new GetReceiptsFromPeerTask(Collections.emptyList(), null, () -> null); new GetReceiptsFromPeerTask(Collections.emptyList(), null, () -> null);
Assertions.assertTrue(task.isPartialSuccess(Collections.emptyMap())); Assertions.assertFalse(task.isSuccess(Collections.emptyMap()));
} }
@Test @Test
public void testIsPartialSuccessForFullSuccess() { public void testIsSuccessForFullSuccess() {
GetReceiptsFromPeerTask task = GetReceiptsFromPeerTask task =
new GetReceiptsFromPeerTask(Collections.emptyList(), null, () -> null); new GetReceiptsFromPeerTask(Collections.emptyList(), null, () -> null);
Map<BlockHeader, List<TransactionReceipt>> map = new HashMap<>(); Map<BlockHeader, List<TransactionReceipt>> map = new HashMap<>();
map.put(mockBlockHeader(1), null); map.put(mockBlockHeader(1), null);
Assertions.assertFalse(task.isPartialSuccess(map)); Assertions.assertTrue(task.isSuccess(map));
} }
private BlockHeader mockBlockHeader(final long blockNumber) { private BlockHeader mockBlockHeader(final long blockNumber) {

Loading…
Cancel
Save