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: Implement test harness seq lock calc. #1577

Merged
merged 1 commit into from
Jan 28, 2019

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Jan 26, 2019

This adds infrastructure to the mempool test harness to allow the faked chain to handle sequence lock calculation for use in upcoming sequence lock tests.

In particular, it modifies the existing CalcSequenceLock function on the faked chain to perform the full sequence lock calculation versus simply returning a lock that is always valid.

Since by-time sequence lock calculation in CalcSequenceLock depends on the ability to calculate the median time for the block before the block that contains the input being spent and the test harness only provides an incomplete faked chain, this introduces a map which tracks the median times per utxo and provides two new functions named FakeUxtoMedianTime and AddFakeUtxoMedianTime which the tests can make use of to properly fake the necessary data to perform the calculations.

Finally, since sequence locks require v2 transactions, the pool harness policy now allows a maximum transaction version of 2.

This adds infrastructure to the mempool test harness to allow the faked
chain to handle sequence lock calculation for use in upcoming sequence
lock tests.

In particular, it modifies the existing CalcSequenceLock function on the
faked chain to perform the full sequence lock calculation versus simply
returning a lock that is always valid.

Since by-time sequence lock calculation in CalcSequenceLock depends on
the ability to calculate the median time for the block before the block
that contains the input being spent and the test harness only provides
an incomplete faked chain, this introduces a map which tracks the median
times per utxo and provides two new functions named FakeUxtoMedianTime
and AddFakeUtxoMedianTime which the tests can make use of to properly
fake the necessary data to perform the calculations.

Finally, since sequence locks require v2 transactions, the pool harness
policy now allows a maximum transaction version of 2.
@davecgh davecgh force-pushed the mempool_test_implement_calcseqlock branch from e36b0c9 to 51330a6 Compare January 28, 2019 15:14
@davecgh davecgh merged commit 51330a6 into decred:master Jan 28, 2019
@davecgh davecgh deleted the mempool_test_implement_calcseqlock branch January 28, 2019 15:26
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.

4 participants