7311: Remove unused code, update tests to use used code (#7772)

* 7311: Remove unused code, update tests to use used code

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

* 7311: Disable invalid test

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>

---------

Signed-off-by: Matilda Clerke <matilda.clerke@consensys.net>
pull/7755/head
Matilda-Clerke 1 month ago committed by GitHub
parent e720d8f670
commit acfbc82aa5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      ethereum/eth/src/main/java/org/hyperledger/besu/ethereum/eth/sync/tasks/GetReceiptsForHeadersTask.java
  2. 20
      ethereum/eth/src/test/java/org/hyperledger/besu/ethereum/eth/sync/tasks/GetReceiptsForHeadersTaskTest.java

@ -42,7 +42,7 @@ import org.slf4j.LoggerFactory;
public class GetReceiptsForHeadersTask
extends AbstractRetryingPeerTask<Map<BlockHeader, List<TransactionReceipt>>> {
private static final Logger LOG = LoggerFactory.getLogger(GetReceiptsForHeadersTask.class);
private static final int DEFAULT_RETRIES = 5;
protected static final int DEFAULT_RETRIES = 5;
private final EthContext ethContext;
@ -65,14 +65,6 @@ public class GetReceiptsForHeadersTask
completeEmptyReceipts(headers);
}
public static GetReceiptsForHeadersTask forHeaders(
final EthContext ethContext,
final List<BlockHeader> headers,
final int maxRetries,
final MetricsSystem metricsSystem) {
return new GetReceiptsForHeadersTask(ethContext, headers, maxRetries, metricsSystem);
}
public static GetReceiptsForHeadersTask forHeaders(
final EthContext ethContext,
final List<BlockHeader> headers,

@ -30,11 +30,19 @@ import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
public class GetReceiptsForHeadersTaskTest
extends RetryingMessageTaskTest<Map<BlockHeader, List<TransactionReceipt>>> {
@BeforeEach
@Override
public void resetMaxRetries() {
maxRetries = GetReceiptsForHeadersTask.DEFAULT_RETRIES;
}
@Override
protected Map<BlockHeader, List<TransactionReceipt>> generateDataToBeRequested() {
// Setup data to be requested and expected response
@ -50,8 +58,7 @@ public class GetReceiptsForHeadersTaskTest
protected EthTask<Map<BlockHeader, List<TransactionReceipt>>> createTask(
final Map<BlockHeader, List<TransactionReceipt>> requestedData) {
final List<BlockHeader> headersToComplete = new ArrayList<>(requestedData.keySet());
return GetReceiptsForHeadersTask.forHeaders(
ethContext, headersToComplete, maxRetries, metricsSystem);
return GetReceiptsForHeadersTask.forHeaders(ethContext, headersToComplete, metricsSystem);
}
@Test
@ -68,4 +75,13 @@ public class GetReceiptsForHeadersTaskTest
assertThat(createTask(expected).run()).isCompletedWithValue(expected);
}
@Override
@Test
@Disabled
public void failsWhenPeerReturnsPartialResultThenStops() {
// Test is not valid when more than 4 retries are allowed, as is always the case with
// GetReceiptsForHeadersTask, because the peer is forcefully disconnected after failing
// too many times
}
}

Loading…
Cancel
Save