Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove static instantiation of network_constants #3420

Merged
merged 30 commits into from
Aug 12, 2021

Conversation

clemahieu
Copy link
Contributor

This change removes static references to network_constants that were littered around the code. Additionally, free-functions related to work difficulty and value calculations were moved on to the work_thrsholds class.

This PR is best reviewed on a per-commit basis, each commit is self-contained with clean test runs.

…dard always_log message. We don't log error messages to cerr so this was out of place.

Removing an unnecessary check for vacuuming within unit tests. This would be functionally equivalent yet potentially a performance issue. Timing the unit tests showed < 1% difference in time.
…ms initialization on to nano::work_thresholds class where they belong.
…_thresholds whre it belongs and to remove static instantiation of network_constants.
…ferences to nano::network_constants from within the ledger processor.
…'s redundant and removing static instantiation of network_constants.
…ssociated static instantiation of network_constants. No appreciable difference in unit test speed.
…on't directly have access to the network constants. node_rpc_config::set_request_callback is used for testing though nothing functionally requires it to be called from a unit test context. write_database_queue::contains checks that it's only called in a unit test context though this is also not functionally required. Calling the count function on several of the db tables has a performance impact though nothing about it is functionally incorrect and the caller needs to determine if the performance hit is acceptable.
…s the responsibility of determining difficulty fully on to work_thresholds rather than splitting this responsibliity with nano::block.
…ias with other instances of ledger_constants.
…nd including a referencing it within ledger_constants and network_constants instead of creating copies.
@zhyatt zhyatt added the quality improvements This item indicates the need for or supplies changes that improve maintainability label Aug 10, 2021
@zhyatt zhyatt added this to the V23.0 milestone Aug 10, 2021
nano/secure/ledger.cpp Outdated Show resolved Hide resolved
@clemahieu clemahieu merged commit bb95786 into develop Aug 12, 2021
@clemahieu clemahieu deleted the removing_static_constants branch August 12, 2021 10:56
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
quality improvements This item indicates the need for or supplies changes that improve maintainability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants