Skip to content

Commit

Permalink
Merge branch 'main' into trie-log-pruning-take2
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Dudley <[email protected]>
  • Loading branch information
siladu committed Oct 25, 2023
2 parents def2160 + 20f518e commit d007a2c
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
import org.hyperledger.besu.plugin.services.MetricsSystem;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -38,20 +40,20 @@ public class GetPooledTransactionsFromPeerTask extends AbstractPeerRequestTask<L
private static final Logger LOG =
LoggerFactory.getLogger(GetPooledTransactionsFromPeerTask.class);

private final List<Hash> hashes;
private final Set<Hash> hashes;

private GetPooledTransactionsFromPeerTask(
final EthContext ethContext, final List<Hash> hashes, final MetricsSystem metricsSystem) {
super(ethContext, EthPV65.GET_POOLED_TRANSACTIONS, metricsSystem);
this.hashes = List.copyOf(hashes);
this.hashes = new HashSet<>(hashes);
}

public static GetPooledTransactionsFromPeerTask forHashes(
final EthContext ethContext, final List<Hash> hashes, final MetricsSystem metricsSystem) {
return new GetPooledTransactionsFromPeerTask(ethContext, hashes, metricsSystem);
}

public List<Hash> getTransactionHashes() {
public Set<Hash> getTransactionHashes() {
return hashes;
}

Expand All @@ -60,7 +62,7 @@ protected PendingPeerRequest sendRequest() {
return sendRequestToPeer(
peer -> {
LOG.debug("Requesting {} transaction pool entries from peer {}.", hashes.size(), peer);
return peer.getPooledTransactions(hashes);
return peer.getPooledTransactions(new ArrayList<>(hashes));
},
0);
}
Expand Down

0 comments on commit d007a2c

Please sign in to comment.