Cache genesis block hash in ledger constants #2512
Merged
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.
Introduced a new member in
ledger_constants
calledgenesis_hash
. The only way to access it currently is through creating a newclass genesis
object and then calling a method which parses all of thegenesis_account
string each time, generates a block then gets the hash from that. This is what the node telemetry currently does, which can be a relatively expensive operation. Also tests use the genesis hash quite frequently so a helper has been added for them too.I replaced all occurrences of
nano::genesis ().hash ()
withnano::genesis_hash
in tests, and also started replacing anynano::genesis genesis;
declarations which were only used withgenesis.hash
andgenesis.open->hash ()
but there was quite a few so haven't done all.Unrelated - there was an [[no_discard]] warning in memory_pool.cpp on Windows which I have fixed with (void) cast.