-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Refactor: Changes time variables from int to chrono #23832
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copncept ACK. I haven't reviewed this, but I left comments
Concept ACK |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
src/net_processing.cpp
Outdated
/** How long to wait (in microseconds) before downloading a transaction from an additional peer */ | ||
static constexpr std::chrono::microseconds GETDATA_TX_INTERVAL{std::chrono::seconds{60}}; | ||
static constexpr auto GETDATA_TX_INTERVAL{60us}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong 60s is not equal to 60us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. I made an error interpreting this line of code earlier.
In the updated PR (commit 16d0b61), I have changed the variable to std::chrono::seconds.
std::chrono::microseconds GETDATA_TX_INTERVAL{std::chrono::seconds{60}};
-> auto GETDATA_TX_INTERVAL{60s};
As I could not see any apparent reason to keep it in microseconds.
17af89f
to
16d0b61
Compare
Updated from 17af89f to 16d0b61 (pr23832.01 -> pr23832.02) Addressed @MarcoFalke comments Changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
crACK 16d0b61
crACK 16d0b61
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 16d0b61 🔠
Show signature
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
ACK 16d0b619d72971b23eabcb0a5849370720f9390 🔠
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUgWGgv/XEpKkyorblBTjNK5oX47xGt3LfLxMXjnRW59LYfE9yo1W+TkYiEYALGN
ltJw9WQCyMpsJYLHrjL9ll6Z6w+ZE4F6MAZybTM2tOMzToDJgLT0+L6eQsb6HDgn
bZhp+HJXtWDrL+kD7RxpNbeeSDVRGDLTUElzuBQRacShUM+aXX2vrf6/tQyih1F+
H7E4EKH9f5ntWlxnT0l2h5ildkX6txh31fU3H9fwrKvRZ5bNZEogGF07fOaZFreE
y06UR4wxelPw4eRKdavhe79GlV6C+uFrf7SNLDzg7CziQTKJbU41m+WZ8f06gtQK
5EkT11i7tKaEiMbUeGIFDFOYsu9xCeTRr6oCM1nomb4iNREKAIClp24XtiN8hQye
kN7QPWoPot5LOk6geT5UN0mti6j5O//fW8kT+7Z1D7aFI7fSBwVqHNjK+YAnXrrk
O3TSZVyXu/+ljzvYWLZUPpqQaa3durNCjOFtV+VyysP7ApasVXK6W/FXx9Zf2uiw
49855sGB
=q2XZ
-----END PGP SIGNATURE-----
@@ -57,8 +57,8 @@ static constexpr auto HEADERS_DOWNLOAD_TIMEOUT_PER_HEADER = 1ms; | |||
* behind headers chain. | |||
*/ | |||
static constexpr int32_t MAX_OUTBOUND_PEERS_TO_PROTECT_FROM_DISCONNECT = 4; | |||
/** Timeout for (unprotected) outbound peers to sync to our chainwork, in seconds */ | |||
static constexpr int64_t CHAIN_SYNC_TIMEOUT = 20 * 60; // 20 minutes | |||
/** Timeout for (unprotected) outbound peers to sync to our chainwork */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will also need to remove "seconds" from where CHAIN_SYNC_TIMEOUT
is used in docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm. Are you talking about this line?
bitcoin/src/net_processing.cpp
Lines 729 to 730 in d69af93
* CHAIN_SYNC_TIMEOUT: if a peer's best known block has less work than our tip, | |
* set a timeout CHAIN_SYNC_TIMEOUT seconds in the future: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line could use a fixing.
However, doing so will revoke the current 3 ACKs on the current top commit of this PR.
So would you suggest I should update this PR for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is fixed, it should be fixed here to avoid another follow-up pull. If not, it might be best to leave it as-is.
A re-ACK is less overhead and effort than a new pull + fresh ACK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in fe86eb5
This commit does following changes to time variables in net_processing.h: - Used {} initialization. - Uses universal initializer auto. - Uses chrono::literals The reason for these changes is to make code simpler, and easier to understand and rationalize.
Updated from 16d0b61 to fe86eb5 (pr23832.02 -> pr23832.03, diff)
Should be trivial to reACK. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re-ACK fe86eb5 🏕
only minor doc change
Show signature
Signature:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
re-ACK fe86eb50c986f7b5ccce63f984d8a51cd9ee9e2c 🏕
only minor doc change
-----BEGIN PGP SIGNATURE-----
iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
pUhSQAv/aT3khOx+9Ns7XrLCiJPyXT33dwP69vqblTWRrSrga/mRkuvsGrAG89xG
z3zhR8Mc5KUA2+OOshFwM4twxSzh/8ugcWAiIQ8P0zkmF+oL+wV1K0l3TLf8W8Vt
gPhIgKt+7t+lNZYvvMCD3bTImrG0/0+/TpuV6NaP+hNKGEmswOaXoqle/kez2ZXU
ObsjBJvlSk3EeBZRDQxh3ZuO99tkhHFM4OzHaAdhoE8zi0c6FCi+uNxSDPs/UH6Z
rYIJnSAYxUZ/DnJUqLZTd59N/tUAZPjBbs/yso6V/tr7yt4tbVVaPaOSzbj/e95B
pqg3xSssL6KYqUzeYudFJY0K2S9nvQM+si7STkqFZ3aSPf1GRcXCbkUEoqVENRMG
yrgIaSC23WrRMas+CSk5gaqKHUTlpM/6WV8KnNaosQbSBhU7mi/lTf6SZNc5XomC
mkek8R4TRft1Q7qivmOrVsSlBuGrrCRjMtc7ddwlJ2f2bz2kLgkwUzw1hsGcf+Lj
nmp944H6
=S8MN
-----END PGP SIGNATURE-----
This PR is a follow-up to #23801.
This PR aims to make the following changes to all the time variables in net_processing.cpp wherever possible.
std::chrono.
chorno::literals
wherever possible.auto
keywords wherever possible.var{val}
convention of initialization.This PR also minimizes the number of times, serialization of time
count_seconds(..)
occurs.