Seems odd to have the assert in the deprecated function, but not in the other.
Fix this by adding it to the other, and by inlining the deprecated one.
Also, use chrono type for the global mocktime variable.
Seems odd to have the assert in the deprecated function, but not in the other.
Fix this by adding it to the other, and by inlining the deprecated one.
Also, use chrono type for the global mocktime variable.
<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For detailed information about the code coverage, see the test coverage report.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline for information on the review process.
| Type | Reviewers |
|---|---|
| ACK | stickies-v, davidgumberg |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
<!--85328a0da195eb286784d51f73fa0af9-->
🚧 At least one of the CI tasks failed. Make sure to run all tests locally, according to the documentation.
Possibly this is due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.
Leave a comment here, if you need help tracking down a confusing failure.
<sub>Debug: https://github.com/bitcoin/bitcoin/runs/23822732364</sub>
Also, inline the deprecated alias to avoid having the two go out of sync
again in the future.
This avoids verbose casts in the lines where the symbol is used.
37 | - 38 | +void SetMockTime(int64_t nMockTimeIn) { SetMockTime(std::chrono::seconds{nMockTimeIn}); } 39 | void SetMockTime(std::chrono::seconds mock_time_in) 40 | { 41 | - nMockTime.store(mock_time_in.count(), std::memory_order_relaxed); 42 | + Assert(mock_time_in >= 0s);
nit: any reason to not just use assert?
Both can be used. In this context they are exactly the same.
ACK fae0db555c12dca75fb09e5fa7bbabdf39b8c1df
33 | -{ 34 | - Assert(nMockTimeIn >= 0); 35 | - nMockTime.store(nMockTimeIn, std::memory_order_relaxed); 36 | -} 37 | - 38 | +void SetMockTime(int64_t nMockTimeIn) { SetMockTime(std::chrono::seconds{nMockTimeIn}); }
nit:
void SetMockTime(int64_t mock_time_in) { SetMockTime(std::chrono::seconds{mock_time_in}); }
I think I'd also have to touch the header to address this, so I'll leave it as-is for now. Also, once could consider to remove this legacy interface function completely.
crACK https://github.com/bitcoin/bitcoin/pull/29872/commits/fae0db555c12dca75fb09e5fa7bbabdf39b8c1df
SetMockTime(std::chrono::seconds mock_time_in should have the Assert added here, and inlining the deprecated function is an improvement.
nMockTime->g_mock_time more closely conforms to the project's naming conventions
Anything left to be done here?