Search in sources :

Example 1 with EthGetFilterChanges

use of org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.EthGetFilterChanges in project besu by hyperledger.

the class EthGetFilterChangesIntegrationTest method setUp.

@BeforeEach
public void setUp() {
    final ExecutionContextTestFixture executionContext = ExecutionContextTestFixture.create();
    blockchain = executionContext.getBlockchain();
    transactions = new GasPricePendingTransactionsSorter(TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS, MAX_TRANSACTIONS, TestClock.fixed(), metricsSystem, blockchain::getChainHeadHeader, TransactionPoolConfiguration.DEFAULT_PRICE_BUMP);
    final ProtocolContext protocolContext = executionContext.getProtocolContext();
    EthContext ethContext = mock(EthContext.class);
    EthPeers ethPeers = mock(EthPeers.class);
    when(ethContext.getEthPeers()).thenReturn(ethPeers);
    transactionPool = new TransactionPool(transactions, executionContext.getProtocolSchedule(), protocolContext, batchAddedListener, ethContext, new MiningParameters.Builder().minTransactionGasPrice(Wei.ZERO).build(), metricsSystem, TransactionPoolConfiguration.DEFAULT);
    final BlockchainQueries blockchainQueries = new BlockchainQueries(blockchain, protocolContext.getWorldStateArchive());
    filterManager = new FilterManagerBuilder().blockchainQueries(blockchainQueries).transactionPool(transactionPool).build();
    method = new EthGetFilterChanges(filterManager);
}
Also used : EthContext(org.hyperledger.besu.ethereum.eth.manager.EthContext) TransactionPool(org.hyperledger.besu.ethereum.eth.transactions.TransactionPool) EthGetFilterChanges(org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.EthGetFilterChanges) BlockchainQueries(org.hyperledger.besu.ethereum.api.query.BlockchainQueries) FilterManagerBuilder(org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManagerBuilder) ExecutionContextTestFixture(org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture) ProtocolContext(org.hyperledger.besu.ethereum.ProtocolContext) FilterManagerBuilder(org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManagerBuilder) EthPeers(org.hyperledger.besu.ethereum.eth.manager.EthPeers) GasPricePendingTransactionsSorter(org.hyperledger.besu.ethereum.eth.transactions.sorter.GasPricePendingTransactionsSorter) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 2 with EthGetFilterChanges

use of org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.EthGetFilterChanges in project besu by hyperledger.

the class EthGetFilterChangesIntegrationTest method setUp.

@BeforeEach
public void setUp() {
    final ExecutionContextTestFixture executionContext = ExecutionContextTestFixture.create();
    blockchain = executionContext.getBlockchain();
    transactions = new BaseFeePendingTransactionsSorter(TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS, MAX_TRANSACTIONS, TestClock.fixed(), metricsSystem, blockchain::getChainHeadHeader, TransactionPoolConfiguration.DEFAULT_PRICE_BUMP);
    final ProtocolContext protocolContext = executionContext.getProtocolContext();
    EthContext ethContext = mock(EthContext.class);
    EthPeers ethPeers = mock(EthPeers.class);
    when(ethContext.getEthPeers()).thenReturn(ethPeers);
    transactionPool = new TransactionPool(transactions, executionContext.getProtocolSchedule(), protocolContext, batchAddedListener, ethContext, new MiningParameters.Builder().minTransactionGasPrice(Wei.ZERO).build(), metricsSystem, TransactionPoolConfiguration.DEFAULT);
    final BlockchainQueries blockchainQueries = new BlockchainQueries(blockchain, protocolContext.getWorldStateArchive());
    filterManager = new FilterManagerBuilder().blockchainQueries(blockchainQueries).transactionPool(transactionPool).build();
    method = new EthGetFilterChanges(filterManager);
}
Also used : EthContext(org.hyperledger.besu.ethereum.eth.manager.EthContext) TransactionPool(org.hyperledger.besu.ethereum.eth.transactions.TransactionPool) EthGetFilterChanges(org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.EthGetFilterChanges) BlockchainQueries(org.hyperledger.besu.ethereum.api.query.BlockchainQueries) FilterManagerBuilder(org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManagerBuilder) BaseFeePendingTransactionsSorter(org.hyperledger.besu.ethereum.eth.transactions.sorter.BaseFeePendingTransactionsSorter) ExecutionContextTestFixture(org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture) ProtocolContext(org.hyperledger.besu.ethereum.ProtocolContext) FilterManagerBuilder(org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManagerBuilder) EthPeers(org.hyperledger.besu.ethereum.eth.manager.EthPeers) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

ProtocolContext (org.hyperledger.besu.ethereum.ProtocolContext)2 FilterManagerBuilder (org.hyperledger.besu.ethereum.api.jsonrpc.internal.filter.FilterManagerBuilder)2 EthGetFilterChanges (org.hyperledger.besu.ethereum.api.jsonrpc.internal.methods.EthGetFilterChanges)2 BlockchainQueries (org.hyperledger.besu.ethereum.api.query.BlockchainQueries)2 ExecutionContextTestFixture (org.hyperledger.besu.ethereum.core.ExecutionContextTestFixture)2 EthContext (org.hyperledger.besu.ethereum.eth.manager.EthContext)2 EthPeers (org.hyperledger.besu.ethereum.eth.manager.EthPeers)2 TransactionPool (org.hyperledger.besu.ethereum.eth.transactions.TransactionPool)2 BeforeEach (org.junit.jupiter.api.BeforeEach)2 BaseFeePendingTransactionsSorter (org.hyperledger.besu.ethereum.eth.transactions.sorter.BaseFeePendingTransactionsSorter)1 GasPricePendingTransactionsSorter (org.hyperledger.besu.ethereum.eth.transactions.sorter.GasPricePendingTransactionsSorter)1