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
public boolean isPartialSuccess(final Map<BlockHeader, List<TransactionReceipt>> result) {
return result.isEmpty();
public boolean isSuccess(final Map<BlockHeader, List<TransactionReceipt>> result) {
return !result.isEmpty();
}
}

@ -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<BlockHeader, List<TransactionReceipt>> map = new HashMap<>();
map.put(mockBlockHeader(1), null);
Assertions.assertFalse(task.isPartialSuccess(map));
Assertions.assertTrue(task.isSuccess(map));
}
private BlockHeader mockBlockHeader(final long blockNumber) {

Loading…
Cancel
Save