-
Notifications
You must be signed in to change notification settings - Fork 106
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
add(mempool): Verify transactions with unmined inputs in the mempool #8857
Conversation
… mempool setup argument, adds and uses an `init_test()` fn for passing a closed channel receiver in tests where no mempool service is needed in the transaction verifier.
…nd a `new_for_tests()` constructor for convenience)
…t receiver, updates tests.
…ol service handle.
…dSet` `transactions()` return type.
…om the mempool's verified set
…m the tx verifier response
…nsparent outputs has been verified. adds a TODO for adding a `pending_outputs` field to the mempool Storage
…ng outputs requests when inserting new transactions into the mempool's verified set
… the caller handle it (required to avoid moving zip317 tx selection code to mempool)
…nless their dependencies have already been added.
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.
I'm trying to figure out what happens if someone submits txs containing a circular dependency. We should make sure we can handle such cases well.
The transaction verifier would return an A similar question around ordering the transactions in block templates caused me some strife (the code should work as expected there too, and it's been excluded from release compilations, but it was difficult to reason about). That exact question may have also caused me some strife a little earlier, as well as what happens to long chains of dependent transactions. |
Avoids unnecessarily rejecting dependent transactions of randomly evicted mempool transactions. Updates `TransactionDependencies::remove_all()` to omit provided transaction id from the list of removed transaction ids.
e213f22
to
5829ef3
Compare
Co-authored-by: Marek <[email protected]>
@mergify refresh |
✅ Pull request refreshed |
@mergify requeue |
❌ This pull request head commit has not been previously disembarked from queue. |
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 1dfac40 |
Motivation
We want to verify transactions in the mempool that spend the transparent outputs of other transactions in the mempool.
Closes #8777.
Solution
AwaitOutput
request in the mempool servicespent_utxos()
method in the transaction verifier to try querying the mempool for spent outpoints before returning aTransparentInputNotFound
error.getblocktemplate
method and ZIP-317 transaction selection to include transactions that spent the outputs of other transactions in the mempool when all of their dependencies have been selectedTests
Added tests to check that:
Storage.remove()
method works as expected (the rest ofevict_one()
should be covered already)AwaitOutput
requests when the output for the queried outpoint is:AwaitOutput
requests as expected and processesUnspentOutput
responses correctlyspent_mempool_outpoints
in its responseIf needed, this PR could also add tests for:
getblocktemplate
method returns transactions with dependencies in the right order when the transaction hashes would have them sorted in the wrong orderFollow Up Work
The mempool's
Downloads
sends a result to the response channel too early, it should wait until the transaction is being inserted into the mempool's verified set.PR Author's Checklist
PR Reviewer's Checklist