Skip to content

Commit ee69279

Browse files
authored
Add getPendingTransactions to TransactionPoolService (#7813)
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
1 parent a3b8863 commit ee69279

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- Fine tune already seen txs tracker when a tx is removed from the pool [#7755](https://github.com/hyperledger/besu/pull/7755)
1212
- Create and publish Besu BOM (Bill of Materials) [#7615](https://github.com/hyperledger/besu/pull/7615)
1313
- Update Java dependencies [#7786](https://github.com/hyperledger/besu/pull/7786)
14+
- Add a method to get all the transaction in the pool, to the `TransactionPoolService`, to easily access the transaction pool content from plugins [#7813](https://github.com/hyperledger/besu/pull/7813)
1415

1516
### Bug fixes
1617

besu/src/main/java/org/hyperledger/besu/services/TransactionPoolServiceImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,12 @@
1414
*/
1515
package org.hyperledger.besu.services;
1616

17+
import org.hyperledger.besu.datatypes.PendingTransaction;
1718
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
1819
import org.hyperledger.besu.plugin.services.transactionpool.TransactionPoolService;
1920

21+
import java.util.Collection;
22+
2023
/** Service to enable and disable the transaction pool. */
2124
public class TransactionPoolServiceImpl implements TransactionPoolService {
2225

@@ -40,4 +43,9 @@ public void disableTransactionPool() {
4043
public void enableTransactionPool() {
4144
transactionPool.setEnabled();
4245
}
46+
47+
@Override
48+
public Collection<? extends PendingTransaction> getPendingTransactions() {
49+
return transactionPool.getPendingTransactions();
50+
}
4351
}

plugin-api/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Calculated : ${currentHash}
7171
tasks.register('checkAPIChanges', FileStateChecker) {
7272
description = "Checks that the API for the Plugin-API project does not change without deliberate thought"
7373
files = sourceSets.main.allJava.files
74-
knownHash = '1VIGlJuGiaEVUksIjTTHDt7SIjjJE9+DU8rYk/ze3XM='
74+
knownHash = 'G3cpM0HGYp4G1u6dN2CRZiEEsgce6jy9rkIlT1blUb4='
7575
}
7676
check.dependsOn('checkAPIChanges')
7777

plugin-api/src/main/java/org/hyperledger/besu/plugin/services/transactionpool/TransactionPoolService.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@
1414
*/
1515
package org.hyperledger.besu.plugin.services.transactionpool;
1616

17+
import org.hyperledger.besu.datatypes.PendingTransaction;
1718
import org.hyperledger.besu.plugin.services.BesuService;
1819

20+
import java.util.Collection;
21+
1922
/** Service to enable and disable the transaction pool. */
2023
public interface TransactionPoolService extends BesuService {
2124
/** Enables the transaction pool. */
2225
void disableTransactionPool();
2326

2427
/** Disables the transaction pool. */
2528
void enableTransactionPool();
29+
30+
/**
31+
* Returns the collection of pending transactions.
32+
*
33+
* @return a collection of pending transactions
34+
*/
35+
Collection<? extends PendingTransaction> getPendingTransactions();
2636
}

0 commit comments

Comments
 (0)