|
|
|
@ -23,6 +23,7 @@ import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.TransactionPen |
|
|
|
|
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.transaction.pool.PendingTransactionFilter; |
|
|
|
|
import org.hyperledger.besu.ethereum.api.jsonrpc.internal.results.transaction.pool.PendingTransactionFilter.Filter; |
|
|
|
|
import org.hyperledger.besu.ethereum.core.Transaction; |
|
|
|
|
import org.hyperledger.besu.ethereum.eth.transactions.PendingTransaction; |
|
|
|
|
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool; |
|
|
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
@ -49,7 +50,10 @@ public class TxPoolBesuPendingTransactions implements JsonRpcMethod { |
|
|
|
|
@Override |
|
|
|
|
public JsonRpcResponse response(final JsonRpcRequestContext requestContext) { |
|
|
|
|
|
|
|
|
|
final Integer limit = requestContext.getRequiredParameter(0, Integer.class); |
|
|
|
|
final Collection<PendingTransaction> pendingTransactions = |
|
|
|
|
transactionPool.getPendingTransactions(); |
|
|
|
|
final Integer limit = |
|
|
|
|
requestContext.getOptionalParameter(0, Integer.class).orElse(pendingTransactions.size()); |
|
|
|
|
final List<Filter> filters = |
|
|
|
|
requestContext |
|
|
|
|
.getOptionalParameter(1, PendingTransactionsParams.class) |
|
|
|
@ -57,7 +61,7 @@ public class TxPoolBesuPendingTransactions implements JsonRpcMethod { |
|
|
|
|
.orElse(Collections.emptyList()); |
|
|
|
|
|
|
|
|
|
final Collection<Transaction> pendingTransactionsFiltered = |
|
|
|
|
pendingTransactionFilter.reduce(transactionPool.getPendingTransactions(), filters, limit); |
|
|
|
|
pendingTransactionFilter.reduce(pendingTransactions, filters, limit); |
|
|
|
|
|
|
|
|
|
return new JsonRpcSuccessResponse( |
|
|
|
|
requestContext.getRequest().getId(), |
|
|
|
|