Skip to content

Commit

Permalink
Add getPendingTransactions to TransactionPoolService (hyperledger#7813)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <[email protected]>
  • Loading branch information
fab-10 authored Oct 27, 2024
1 parent a3b8863 commit ee69279
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Fine tune already seen txs tracker when a tx is removed from the pool [#7755](https://github.com/hyperledger/besu/pull/7755)
- Create and publish Besu BOM (Bill of Materials) [#7615](https://github.com/hyperledger/besu/pull/7615)
- Update Java dependencies [#7786](https://github.com/hyperledger/besu/pull/7786)
- 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)

### Bug fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@
*/
package org.hyperledger.besu.services;

import org.hyperledger.besu.datatypes.PendingTransaction;
import org.hyperledger.besu.ethereum.eth.transactions.TransactionPool;
import org.hyperledger.besu.plugin.services.transactionpool.TransactionPoolService;

import java.util.Collection;

/** Service to enable and disable the transaction pool. */
public class TransactionPoolServiceImpl implements TransactionPoolService {

Expand All @@ -40,4 +43,9 @@ public void disableTransactionPool() {
public void enableTransactionPool() {
transactionPool.setEnabled();
}

@Override
public Collection<? extends PendingTransaction> getPendingTransactions() {
return transactionPool.getPendingTransactions();
}
}
2 changes: 1 addition & 1 deletion plugin-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,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 = '1VIGlJuGiaEVUksIjTTHDt7SIjjJE9+DU8rYk/ze3XM='
knownHash = 'G3cpM0HGYp4G1u6dN2CRZiEEsgce6jy9rkIlT1blUb4='
}
check.dependsOn('checkAPIChanges')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,23 @@
*/
package org.hyperledger.besu.plugin.services.transactionpool;

import org.hyperledger.besu.datatypes.PendingTransaction;
import org.hyperledger.besu.plugin.services.BesuService;

import java.util.Collection;

/** Service to enable and disable the transaction pool. */
public interface TransactionPoolService extends BesuService {
/** Enables the transaction pool. */
void disableTransactionPool();

/** Disables the transaction pool. */
void enableTransactionPool();

/**
* Returns the collection of pending transactions.
*
* @return a collection of pending transactions
*/
Collection<? extends PendingTransaction> getPendingTransactions();
}

0 comments on commit ee69279

Please sign in to comment.