Skip to content

Commit

Permalink
Revert plugin interface to return object instead of list
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel-Trintinalia <[email protected]>
  • Loading branch information
Gabriel-Trintinalia committed Oct 6, 2023
1 parent 0b83ab5 commit a2a3236
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import java.util.Optional;
import java.util.concurrent.CancellationException;
import java.util.function.Supplier;
import java.util.stream.Collectors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -118,7 +119,8 @@ public BlockTransactionSelector(
transactionPool);
transactionSelectors = createTransactionSelectors(blockSelectionContext);
externalTransactionSelectors =
transactionSelectorFactory.map(TransactionSelectorFactory::create).orElse(List.of());
createExternalTransactionSelectors(
transactionSelectorFactory.map(List::of).orElseGet(List::of));
}

/**
Expand Down Expand Up @@ -324,4 +326,11 @@ private List<AbstractTransactionSelector> createTransactionSelectors(
new BlobPriceTransactionSelector(context),
new ProcessingResultTransactionSelector(context));
}

private List<TransactionSelector> createExternalTransactionSelectors(
final List<TransactionSelectorFactory> transactionSelectorFactory) {
return transactionSelectorFactory.stream()
.map(TransactionSelectorFactory::create)
.collect(Collectors.toList());
}
}
2 changes: 1 addition & 1 deletion plugin-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Calculated : ${currentHash}
tasks.register('checkAPIChanges', FileStateChecker) {
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
files = sourceSets.main.allJava.files
knownHash = 'IPqcFdM1uy+ZDbcvzsKxMIrzhP9VoaSeanhBOLtbhfE='
knownHash = 'n7Nr+J78ImUPzFxTa6Ig5C7Ul4nSM+AZnsLGQY0dL60='
}
check.dependsOn('checkAPIChanges')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

import org.hyperledger.besu.plugin.Unstable;

import java.util.List;

/** Interface for a factory that creates transaction selectors */
@Unstable
public interface TransactionSelectorFactory {
Expand All @@ -28,5 +26,5 @@ public interface TransactionSelectorFactory {
*
* @return the transaction selector list
*/
List<TransactionSelector> create();
TransactionSelector create();
}

0 comments on commit a2a3236

Please sign in to comment.