Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

[PAN-1062] Specify pending transaction retention period (2 of 2) #1333

Merged
merged 26 commits into from
Apr 30, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
PENDING_TX_RETENTION_HOURS
  • Loading branch information
smatthewenglish committed Apr 30, 2019
commit f42344d41500241c904683161413456b229c0fc2
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void startNode(final PantheonNode node) {
.nodePrivateKeyFile(KeyPairUtil.getDefaultKeyFile(node.homeDirectory()))
.metricsSystem(noOpMetricsSystem)
.maxPendingTransactions(PendingTransactions.MAX_PENDING_TRANSACTIONS)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_PERIOD)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_HOURS)
.rocksdDbConfiguration(
new RocksDbConfiguration.Builder().databaseDir(tempDir).build())
.ethereumWireProtocolConfiguration(EthereumWireProtocolConfiguration.defaultConfig())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* <p>This class is safe for use across multiple threads.
*/
public class PendingTransactions {
public static final int PENDING_TX_RETENTION_PERIOD = 13;
public static final int PENDING_TX_RETENTION_HOURS = 13;
public static final int MAX_PENDING_TRANSACTIONS = 4096;

private final Map<Hash, TransactionInfo> pendingTransactions = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ void setBootnodes(final List<String> values) {
description =
"Maximum retention period of pending transactions in the transaction pool (default: ${DEFAULT-VALUE})",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need unit in the text if we stay at long/integer.

arity = "1")
private final Integer pendingTxRetentionPeriod = PendingTransactions.PENDING_TX_RETENTION_PERIOD;
private final Integer pendingTxRetentionPeriod = PendingTransactions.PENDING_TX_RETENTION_HOURS;

// Inner class so we can get to loggingLevel.
public class PantheonExceptionHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void privacyPrecompiled() throws IOException {
.clock(TestClock.fixed())
.privacyParameters(privacyParameters)
.maxPendingTransactions(PendingTransactions.MAX_PENDING_TRANSACTIONS)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_PERIOD)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_HOURS)
.build();

final Address privacyContractAddress = Address.privacyPrecompiled(ADDRESS);
Expand Down
6 changes: 3 additions & 3 deletions pantheon/src/test/java/tech/pegasys/pantheon/RunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ private void syncFromGenesis(final SyncMode mode) throws Exception {
.clock(TestClock.fixed())
.maxPendingTransactions(PendingTransactions.MAX_PENDING_TRANSACTIONS)
.storageProvider(createKeyValueStorageProvider(dbAhead))
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_PERIOD)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_HOURS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move up a line, next to maxPendingTransacitons.

.build()) {
setupState(blockCount, controller.getProtocolSchedule(), controller.getProtocolContext());
}
Expand All @@ -153,7 +153,7 @@ private void syncFromGenesis(final SyncMode mode) throws Exception {
.clock(TestClock.fixed())
.maxPendingTransactions(PendingTransactions.MAX_PENDING_TRANSACTIONS)
.storageProvider(createKeyValueStorageProvider(dbAhead))
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_PERIOD)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_HOURS)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move up a line, next to maxPendingTransacitons.

.build();
final String listenHost = InetAddress.getLoopbackAddress().getHostAddress();
final JsonRpcConfiguration aheadJsonRpcConfiguration = jsonRpcConfiguration();
Expand Down Expand Up @@ -210,7 +210,7 @@ private void syncFromGenesis(final SyncMode mode) throws Exception {
.privacyParameters(PrivacyParameters.DEFAULT)
.clock(TestClock.fixed())
.maxPendingTransactions(PendingTransactions.MAX_PENDING_TRANSACTIONS)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_PERIOD)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_HOURS)
.build();
final EnodeURL enode = runnerAhead.getLocalEnode().get();
final EthNetworkConfig behindEthNetworkConfiguration =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public void noOverrideDefaultValuesIfKeyIsNotPresentInConfigFile() throws IOExce

/* * */
verify(mockControllerBuilder)
.pendingTransactionRetentionPeriod(eq(PendingTransactions.PENDING_TX_RETENTION_PERIOD));
.pendingTransactionRetentionPeriod(eq(PendingTransactions.PENDING_TX_RETENTION_HOURS));
/* * */

verify(mockControllerBuilder).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void blockImport() throws IOException {
.dataDirectory(dataDir)
.clock(TestClock.fixed())
.maxPendingTransactions(PendingTransactions.MAX_PENDING_TRANSACTIONS)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_PERIOD)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_HOURS)
.build();
final BlockImporter.ImportResult result =
blockImporter.importBlockchain(source, targetController);
Expand Down Expand Up @@ -105,7 +105,7 @@ public void ibftImport() throws IOException {
.dataDirectory(dataDir)
.clock(TestClock.fixed())
.maxPendingTransactions(PendingTransactions.MAX_PENDING_TRANSACTIONS)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_PERIOD)
.pendingTransactionRetentionPeriod(PendingTransactions.PENDING_TX_RETENTION_HOURS)
.build();
final BlockImporter.ImportResult result = blockImporter.importBlockchain(source, controller);

Expand Down