-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Make CCoinsViewCache::Cursor() return latest data #9306
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
Conversation
|
Concept ACK |
6494980 to
d58b56d
Compare
|
|
My hope is that at some point we can switch to a rolling UTXO hash (see my MuHash PR, and mailinglist thread), so gettxoutsetinfo does not need to interate over the set anymore but compute everything using continuously updated stats. |
|
It's probably better to not merge this until we can rid of the necessity to iterate over the entire set in |
|
Probably this PR isn't needed unless #9152 or #9137 or something similar will be added. But I do think the fact that CCCoinsViewCache::Cursor() returns a cursor that doesn't actually iterate over the latest data in the view is confusing and could lead to bugs. Opened #10550 for a more direct solution to that problem. |
Change CCoinsViewCache::Cursor() method to return a cursor yielding the latest CCoins entries, instead of just previous entries prior to the last cache flush. The CCoinsViewCache::Cursor method is not currently used. This change just enables new features that rely on scanning the UXTO set to work correctly (for example bitcoin#9152, which adds a sweepprivkeys RPC, and bitcoin#9137, which improves handling of imported keys for nodes with pruning enabled.)
d58b56d to
095c2e7
Compare
|
I think #10550 is sufficient for now, and we won't need this until there is an actual use for iterating the UTXO set in a non-well-defined order? |
|
All right, I'm not really working on #9137 anyway, will close. |
|
@jonasschnelli, do you think this PR might be useful for your "scantxoutset" RPC (https://botbot.me/freenode/bitcoin-core-dev/msg/94684446/). It makes CCoinsViewCache::Cursor() return the latest data instead of stale data. |
Followup: Code is currently calling FlushStateToDisk so this should not be needed (https://botbot.me/freenode/bitcoin-core-dev/msg/94920590/) |
|
Followup: Flush was removed according to https://botbot.me/freenode/bitcoin-core-dev/msg/95804751/ so this PR might be useful again. Implementation in #12196 does include a flush though, currently. |
|
This is definitively useful (could lead to removing the state flush in #12196). |
|
Should this be marked "Up for grabs"? cc @ryanofsky |
I don't know if the PR is up for grabs, more like uses of the PR are up for grabs. My motivation for this PR was let to wallet scan utxo set instead of blocks, and be able to get wallet balance if not full transaction history with a pruned node. Sipa, laanwj, and jonas above and luke in #9152 had other potential uses. The PR itself is simple and probably very easy to rebase. Just doesn't make sense without a use-case |
Change CCoinsViewCache::Cursor() method to return a cursor yielding the latest CCoins entries, instead of just previous entries prior to the last cache flush.
The CCoinsViewCache::Cursor method is not currently used. This change just enables new features that rely on scanning the UXTO set to work correctly (for example #9152, which adds a sweepprivkeys RPC, and #9137, which improves handling of imported keys for nodes with pruning enabled.)