Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mempool: Use median time for tx finality checks. #860

Merged
merged 1 commit into from
Sep 20, 2017

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Sep 18, 2017

This modifies the mempool transaction finality checks to use the past median time instead of the adjusted network time. This ensures the standardness rules match the upcoming consensus rules which reject transactions that are not after the median time of the last several blocks. Without this change, it is possible for transactions which can never make it into a block to be admitted to the mempool thereby wasting memory.

The following is an overview of the changes:

  • Introduce a new callback to the mempool config named PastMedianTime for obtaining the median time for the current best chain so it can remain decoupled from the chain
  • Update the tx finality standardness check to use the callback
  • Remove the now unused TimeSource mempool config parameter
  • Update the mempool test harness and mock chain to use a mock median time
  • Update server to provide a closure for the mempool config that uses the cached median time for the current best chain to negate any additional performance impact the new calculations would otherwise cause from recalculating the median time for every new candidate tx validation

@davecgh davecgh force-pushed the mempool_median_time_tx_finality branch 2 times, most recently from 9cbe051 to e063d94 Compare September 20, 2017 09:13
This modifies the mempool transaction finality checks to use the past
median time instead of the adjusted network time.  This ensures the
standardness rules match the upcoming consensus rules which reject
transactions that are not after the median time of the last several
blocks.  Without this change, it is possible for transactions which can
never make it into a block to be admitted to the mempool thereby wasting
memory.

The following is an overview of the changes:

- Introduce a new callback to the mempool config named PastMedianTime
  for obtaining the median time for the current best chain so it can
  remain decoupled from the chain
- Update the tx finality standardness check to use the callback
- Remove the now unused TimeSource mempool config parameter
- Update the mempool test harness and mock chain to use a mock median time
- Update server to provide a closure for the mempool config that uses
  the cached median time for the current best chain to negate any
  additional performance impact the new calculations would otherwise
  cause from recalculating the median time for every new candidate tx
  validation
@davecgh davecgh force-pushed the mempool_median_time_tx_finality branch from e063d94 to ecf5f0a Compare September 20, 2017 09:13
@davecgh davecgh merged commit ecf5f0a into decred:master Sep 20, 2017
@davecgh davecgh deleted the mempool_median_time_tx_finality branch September 20, 2017 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants