forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Use rolling muhash for UTXO set hash #25
Closed
Closed
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
maflcko
reviewed
Aug 26, 2019
For reference here are the branches with the alternative hashing algorithms, but these are not implemented as rolling, yet. https://github.com/fjahr/bitcoin/tree/lthash |
fjahr
force-pushed
the
muhash-rolling
branch
2 times, most recently
from
August 27, 2019 22:01
fc60e51
to
c4681d1
Compare
The UtxoSetHash is implemented as an index (subclass of BaseIndex) and maintains data in LevelDB. It keeps the muhash for each block in the database and also allows to search them by block hash or height. It also maintains the global Muhash object which is being modified as new blocks get added to the chain or as reorgs happen. This commit also adds a serialization method to the Muhash object to be able to persist it between restarts of the node.
fjahr
force-pushed
the
muhash-rolling
branch
from
September 4, 2019 13:53
25c2d29
to
850c366
Compare
fjahr
force-pushed
the
muhash-rolling
branch
from
September 4, 2019 22:15
850c366
to
e278ece
Compare
fjahr
changed the title
Use rolling muhash for UTXO set hash in gettxoutsetinfo
Use rolling muhash for UTXO set hash
Sep 4, 2019
Can you set the base branch to master for this? |
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 PR is an update to bitcoin#10434. It implements a rolling UTXO set hash using the Muhash algorithm. The hash is accessible through the
gettxoutsetinfo
RPC call.Design info:
UtxoSetHash
is functioning as an Index (subclass ofBaseIndex
). It maintains the current Muhash objectm_muhash
that is updated with changes in the blockchain. It also saves 256bit digests of the Muhash for every block.An alternative design could have hooked into
ValidationInterface
directly and used a flat-file structure for persistence instead of the DB. Thoughts on these alternatives welcome.Find more details in the Proposal.
Known todos:
hash
may refer to an instance ofMuHash3072
orUtxoSetHash
or a 256bit hash digest. This may be confusing and I want to clean this up naming all instances ofMuHash
something includingmuhash
and everything referring to 256bit hashes something nameddigest
WriteBlock
andReverseBlock
method could be considerably DRYed upgettxoutsetinfo
respond instantly, the other statistics that are collected by looping over the UTXO set will need to be updated on a rolling basis as well:total_amount
,bogosize
,txouts
,transactions