diff options
author | furszy <matiasfurszyfer@protonmail.com> | 2023-12-19 09:50:37 -0300 |
---|---|---|
committer | furszy <matiasfurszyfer@protonmail.com> | 2024-01-15 10:28:20 -0300 |
commit | 9f36e591c551ec2e58a6496334541bfdae8fdfe5 (patch) | |
tree | aac5d45e617133f5caa8db9f9dec5ea6b45af0cc /src/protocol.cpp | |
parent | f9ac96b8d6f4eba23c88f302b22a2c676e351263 (diff) | |
download | bitcoin-9f36e591c551ec2e58a6496334541bfdae8fdfe5.tar.xz |
net: move state dependent peer services flags
No behavior change. Just an intermediate refactoring.
By relocating the peer desirable services flags into the peer
manager, we allow the connections acceptance process to handle
post-IBD potential stalling scenarios.
In the follow-up commit(s), the desirable service flags will be
dynamically adjusted to detect post-IBD stalling scenarios (such
as a +48-hour inactive node that must prefer full node connections
instead of limited peer connections because they cannot provide
historical blocks). Additionally, this encapsulation enable us
to customize the connections decision-making process based on
new user's configurations in the future.
Diffstat (limited to 'src/protocol.cpp')
-rw-r--r-- | src/protocol.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp index 27a0a2ffc1..694c13a7a8 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -125,18 +125,12 @@ bool CMessageHeader::IsCommandValid() const return true; } - -ServiceFlags GetDesirableServiceFlags(ServiceFlags services) { - if ((services & NODE_NETWORK_LIMITED) && g_initial_block_download_completed) { - return ServiceFlags(NODE_NETWORK_LIMITED | NODE_WITNESS); - } - return ServiceFlags(NODE_NETWORK | NODE_WITNESS); -} - void SetServiceFlagsIBDCache(bool state) { g_initial_block_download_completed = state; } +bool GetServicesFlagsIBDCache() { return g_initial_block_download_completed; } + CInv::CInv() { type = 0; |