forked from dashpay/dash
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
[Refactoring] Break circular dependency main ↔ txdb #1797
Merged
random-zebra
merged 2 commits into
PIVX-Project:master
from
random-zebra:break_txdb_main_dep
Aug 12, 2020
Merged
[Refactoring] Break circular dependency main ↔ txdb #1797
random-zebra
merged 2 commits into
PIVX-Project:master
from
random-zebra:break_txdb_main_dep
Aug 12, 2020
Conversation
This file contains 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
>>> backports bitcoin/bitcoin@509cb00 Add a method Cursor() to CCoinsView that returns a cursor which can be used to iterate over the whole UTXO set. - rpc: Change gettxoutsetinfo to use new Cursor method - txdb: Remove GetStats method - Now that GetStats is implemented in terms of Cursor, remove it.
random-zebra
added
Upstream
Refactoring
UTXO DBs and Indexes
REST
Pertaining specifically to the REST API
labels
Aug 9, 2020
random-zebra
added this to In Progress
in perpetual updating PIVX Core to BTC Core
via automation
Aug 9, 2020
7 tasks
furszy
approved these changes
Aug 11, 2020
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.
ACK 5147571
perpetual updating PIVX Core to BTC Core
automation
moved this from In Progress
to Ready
Aug 12, 2020
Fuzzbawls
approved these changes
Aug 12, 2020
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.
ACK 5147571
random-zebra
added a commit
that referenced
this pull request
Sep 5, 2020
535d8e4 scripted-diff: various renames for per-utxo consistency (random-zebra) 60c73ad Rename CCoinsCacheEntry::coins to coin (Pieter Wuille) 1166f1f Merge CCoinsViewCache's GetOutputFor and AccessCoin (Pieter Wuille) f25d3c6 [MOVEONLY] Move old CCoins class to txdb.cpp (random-zebra) aab17b3 Upgrade from per-tx database to per-txout (Pieter Wuille) a55eb98 Reduce reserved memory space for flushing (random-zebra) 7d637ea Remove unused CCoins methods (random-zebra) 4b7b1a3 Extend coins_tests (random-zebra) 8cf2dc0 Switch CCoinsView and chainstate db from per-txid to per-txout (random-zebra) b20a662 [Cleanup] Remove unused CCoinsViewCache::IsOutputAvailable (random-zebra) ea82855 Refactor GetUTXOStats in preparation for per-COutPoint iteration (Pieter Wuille) 0f9f2b6 [Core] Fix not-pruned-check in miner for zerocoin mint outputs (random-zebra) 3698d47 Replace CCoins-based CTxMemPool::pruneSpent with isSpent (Pieter Wuille) 11c728a Remove ModifyCoins/ModifyNewCoins (Pieter Wuille) 3c65936 Switch tests from ModifyCoins to AddCoin/SpendCoin (random-zebra) b05fe55 Switch CScriptCheck to use Coin instead of CCoins (random-zebra) 9e5c2ae Only pass things committed to by tx's witness hash to CScriptCheck (random-zebra) 22b0b4a [Cleanup] fix warning in comparisons with nCoinbaseMaturity (random-zebra) 666081d Switch from per-tx to per-txout CCoinsViewCache methods in some places (random-zebra) 53fc2be [Core] PIVX: remove potential_overwrite: BIP34 has always been enforced (random-zebra) 16924aa Introduce new per-txout CCoinsViewCache functions (random-zebra) 2d74bc1 Optimization: Coin&& to ApplyTxInUndo (random-zebra) 3fcb092 Replace CTxInUndo with Coin (random-zebra) 42a8996 [Core] PIVX: Add fCoinStake boolean field to Coin class (random-zebra) a01a9f2 Introduce Coin, a single unspent output (random-zebra) Pull request description: The chainstate database, and its cache, rely on a per-tx model (i.e. it is a map from txids to *lists* of unspent outputs). This PR chages it to a per-txout model (i.e. a map from outpoints to *single* unspent outputs). Pros: - Simpler code. - Avoiding the CPU overhead of deserializing and serializing the unused outputs. - More predictable memory usage. - More easily adaptable to various cache flushing strategies. Cons: - Slightly larger on-disk representation, and sometimes larger in-memory representation (when there are multiple outputs for the same txid in the cache, which becomes optional). Adapted from bitcoin#10195 (adding a `fCoinStake` boolean memeber to the Coin class and considering BIP34 always in effect as per #1775) Based on top of: - [x] #1799 - [x] #1800 - [x] #1797 - [x] #1796 - [x] #1795 - [x] #1793 - [x] #1773 The actual PR starts with "Introduce Coin, a single unspent output" (171bf0b)⚠️ **Note for testers**: Do a backup of the chainstate before testing. With this PR, at startup, the database is automatically upgraded to the new format (so a reindex is not needed). ACKs for top commit: furszy: Code review ACK 535d8e4. Need some live testing now. furszy: ACK 535d8e4 Fuzzbawls: ACK 535d8e4 Tree-SHA512: 8648d31c343ff901f8568c14d0848241c9b8aca0b9a8f89f3e5dbe02d384ba35faf572757e84f979fba1f198d721a2516d0e784b5e0dc8d02b6e308b4278b484
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Other two quick backports needed for the upcoming per-txout model.
Add cursor to iterate over utxo set, use this in
gettxoutsetinfo
bitcoin/bitcoin#7756 - Add cursor to iterate over utxo set, use this ingettxoutsetinfo
Break circular dependency main ↔ txdb bitcoin/bitcoin#7815 - Break circular dependency main ↔ txdb (part of this was done already in [Refactor] Move CBlockFileInfo and CValidationState out of main #1302 and [Refactor] Move CDiskTxPos/CBlockUndo to txdb.h/undo.h respectively #1319)