More split-outs from UTXO hasher#101
Merged
galpHub merged 3 commits intoDiviProject:Developmentfrom Jun 30, 2021
Merged
Conversation
This refactors some parts of the code (mainly the UTXO tracking) to use TransactionLocationReference more consistently instead of e.g. ad-hoc passing of a raw block height. Describing the "details" of a transaction in the blockchain (including transaction hash and confirmed block height) is what TransactionLocationReference is meant for, so this makes sense. With these changes, it will also be easier to use the UTXO hash of a transaction in the future, as that will just be added seamlessly to TransactionLocationReference and then won't need to be customarily wired through.
The memory pool mainly tracks transactions by txid; however, in some places, we actually need to look up the transaction by the output hash it creates (which will be different from the txid after segwit light). This introduces a new method CTxMemPool::lookupOutpoint, which is meant to be used for these situations (even though for now it does the same as lookup). It also updates the code to use the new method where this is appropriate.
|
Looks good overall. If you could add some additional mempool tests regarding |
This extends the mempool unit tests to explicitly verify lookup both by normal and bare txid, the two exists calls (with normal and bare txid) as well as the new lookupOutpoint method.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a set of two more independent changes split out from #80:
TransactionLocationReferencemore consistently in the code; instead of passing around raw transaction heights in some places, pass in theTransactionLocationReferenceCTxMemPool::lookupOutpointmethod, which looks up a mempool transaction by the outpoint for spending (what will be the UTXO hash in the future)