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: Update fraud proof data. #2804

Merged
merged 5 commits into from Nov 16, 2021
Merged

Conversation

rstaudt2
Copy link
Member

@rstaudt2 rstaudt2 commented Nov 13, 2021

This is rebased on #2802.

This updates the fraud proof data on transaction inputs as necessary when entering the mempool. The fraud proof data will ultimately get filled in properly when miners create a block template. However, ensuring that it is filled in properly when entering the mempool is beneficial so that it is correct when relaying the transaction or returning it from an RPC API.

Additionally, this updates mempool to now set the check fraud proof flag to true for blockchain.CheckTransactionInputs since mempool now ensures that the fraud proof is correct for all transaction inputs prior to this check.

Finally, this adds tests to validate that the fraud proof of transaction inputs is corrected as necessary when entering the mempool under a variety of conditions.

Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

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

This looks good. The tests offer great coverage and hit all possible combinations of updates. I also tested it locally on simnet with a few transactions to ensure they do in fact come back up of the RPC server with the updated information as expected.

internal/mempool/mempool.go Show resolved Hide resolved
@davecgh davecgh added this to the 1.7.0 milestone Nov 14, 2021
This updates a mempool test to compare the values of hashes rather than
the pointers as intended.
This updates the fraud proof data on transaction inputs as necessary
when entering the mempool.  The fraud proof data will ultimately get
filled in properly when miners create a block template.  However,
ensuring that it is filled in properly when entering the mempool is
beneficial so that it is correct when relaying the transaction or
returning it from an RPC API.
This updates mempool to now set the check fraud proof flag to true for
blockchain.CheckTransactionInputs since mempool now ensures that the
fraud proof is correct for all transaction inputs prior to this check.
This adds a blockHeight parameter to the AddFakeUTXO test function so
that it can be mocked rather than always being set to
wire.NullBlockIndex.
This adds tests to validate that the fraud proof of transaction inputs
is corrected as necessary when entering the mempool under a variety of
conditions.
@davecgh davecgh merged commit 2cd3941 into decred:master Nov 16, 2021
@rstaudt2 rstaudt2 deleted the mempool-fraud-proof branch November 22, 2021 21:16
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.

None yet

4 participants