-
Notifications
You must be signed in to change notification settings - Fork 130
Track added at in txpool #1048
Track added at in txpool #1048
Conversation
@@ -109,7 +110,7 @@ public void proposerAddressCanBeExtractFromAConstructedBlock() { | |||
new CliqueBlockCreator( | |||
coinbase, | |||
parent -> extraData.encode(), | |||
new PendingTransactions(5), | |||
new PendingTransactions(5, Clock.systemUTC()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use the fixed clock in tests please? Real-time in tests comes back to bite you. Might need a util method somewhere to make it easy since Clock.fixed
requires specifying a time and we generally don't care what time is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a TestClock with a fixed() static method.
@@ -147,7 +147,7 @@ private MainnetPantheonController( | |||
|
|||
final TransactionPool transactionPool = | |||
TransactionPoolFactory.createTransactionPool( | |||
protocolSchedule, protocolContext, ethProtocolManager.ethContext()); | |||
protocolSchedule, protocolContext, ethProtocolManager.ethContext(), Clock.systemUTC()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good if we could only create one clock instance in the controller (there's a second one being passed to DefaultBlockScheduler
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done -- we now have a single call to Clock.systemUTC()
in the codebase.
} | ||
|
||
@JsonGetter(value = "hash") | ||
public String getHash() { | ||
return hash; | ||
} | ||
|
||
@JsonGetter(value = "addedToPoolAt") | ||
public long getAddedToPoolAt() { | ||
return addedToPoolAt.toEpochMilli(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed this should be ISO8601 format rather than epoch millis.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool -- have used toString on the instant which returns an ISO8601 string.
120a920
to
8a3aedd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…and expose this out through the api.
TestClock class added with a factory method for a fixed clock.
4c0e8d9
to
4e177af
Compare
Store the instant that a pending transaction is added to the txpool, and expose this out through the api.