-
Notifications
You must be signed in to change notification settings - Fork 1.2k
backport: Merge bitcoin/bitcoin#30397, 22729, 29633, 29459 #7300
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
base: develop
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3956,24 +3956,36 @@ bool CConnman::Bind(const CService& addr_, unsigned int flags, NetPermissionFlag | |
|
|
||
| bool CConnman::InitBinds(const Options& options) | ||
| { | ||
| bool fBound = false; | ||
| for (const auto& addrBind : options.vBinds) { | ||
| fBound |= Bind(addrBind, BF_REPORT_ERROR, NetPermissionFlags::None); | ||
| if (!Bind(addrBind, BF_REPORT_ERROR, NetPermissionFlags::None)) { | ||
| return false; | ||
| } | ||
| } | ||
| for (const auto& addrBind : options.vWhiteBinds) { | ||
| fBound |= Bind(addrBind.m_service, BF_REPORT_ERROR, addrBind.m_flags); | ||
| if (!Bind(addrBind.m_service, BF_REPORT_ERROR, addrBind.m_flags)) { | ||
| return false; | ||
| } | ||
| } | ||
| for (const auto& addr_bind : options.onion_binds) { | ||
| fBound |= Bind(addr_bind, BF_DONT_ADVERTISE, NetPermissionFlags::None); | ||
| if (!Bind(addr_bind, BF_REPORT_ERROR | BF_DONT_ADVERTISE, NetPermissionFlags::None)) { | ||
| return false; | ||
|
Comment on lines
+3970
to
+3971
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||
| } | ||
| } | ||
| if (options.bind_on_any) { | ||
| // Don't consider errors to bind on IPv6 "::" fatal because the host OS | ||
| // may not have IPv6 support and the user did not explicitly ask us to | ||
| // bind on that. | ||
| const CService ipv6_any{in6_addr(IN6ADDR_ANY_INIT), GetListenPort()}; // :: | ||
| Bind(ipv6_any, BF_NONE, NetPermissionFlags::None); | ||
|
|
||
| struct in_addr inaddr_any; | ||
| inaddr_any.s_addr = htonl(INADDR_ANY); | ||
| struct in6_addr inaddr6_any = IN6ADDR_ANY_INIT; | ||
| fBound |= Bind(CService(inaddr6_any, GetListenPort()), BF_NONE, NetPermissionFlags::None); | ||
| fBound |= Bind(CService(inaddr_any, GetListenPort()), !fBound ? BF_REPORT_ERROR : BF_NONE, NetPermissionFlags::None); | ||
| const CService ipv4_any{inaddr_any, GetListenPort()}; // 0.0.0.0 | ||
| if (!Bind(ipv4_any, BF_REPORT_ERROR, NetPermissionFlags::None)) { | ||
| return false; | ||
| } | ||
| } | ||
| return fBound; | ||
| return true; | ||
| } | ||
|
|
||
| bool CConnman::Start(CDeterministicMNManager& dmnman, CMasternodeMetaMan& mn_metaman, CMasternodeSync& mn_sync, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -118,20 +118,20 @@ std::vector<NodeEvictionCandidate> GetRandomNodeEvictionCandidates(int n_candida | |||||||
| std::vector<NodeEvictionCandidate> candidates; | ||||||||
| for (int id = 0; id < n_candidates; ++id) { | ||||||||
|
Comment on lines
118
to
119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Blocking: Missing prerequisite: bitcoin#26642 Upstream's pre-bitcoin#30397 helper had Policy gate (backport-prereq-restore): For full upstream backport PRs, a missing prerequisite is blocking unless the finding is explicitly allowlisted (e.g.
Suggested change
source: ['codex-backport-reviewer'] |
||||||||
| candidates.push_back({ | ||||||||
| /*id=*/id, | ||||||||
| /*m_connected=*/std::chrono::seconds{random_context.randrange(100)}, | ||||||||
| /*m_min_ping_time=*/std::chrono::microseconds{random_context.randrange(100)}, | ||||||||
| /*m_last_block_time=*/std::chrono::seconds{random_context.randrange(100)}, | ||||||||
| /*m_last_tx_time=*/std::chrono::seconds{random_context.randrange(100)}, | ||||||||
| /*fRelevantServices=*/random_context.randbool(), | ||||||||
| /*m_relay_txs=*/random_context.randbool(), | ||||||||
| /*fBloomFilter=*/random_context.randbool(), | ||||||||
| /*nKeyedNetGroup=*/random_context.randrange(100), | ||||||||
| /*prefer_evict=*/random_context.randbool(), | ||||||||
| /*m_is_local=*/random_context.randbool(), | ||||||||
| /*m_network=*/ALL_NETWORKS[random_context.randrange(ALL_NETWORKS.size())], | ||||||||
| /*m_noban=*/false, | ||||||||
| /*m_conn_type=*/ConnectionType::INBOUND, | ||||||||
| .id=id, | ||||||||
| .m_connected=std::chrono::seconds{random_context.randrange(100)}, | ||||||||
| .m_min_ping_time=std::chrono::microseconds{random_context.randrange(100)}, | ||||||||
| .m_last_block_time=std::chrono::seconds{random_context.randrange(100)}, | ||||||||
| .m_last_tx_time=std::chrono::seconds{random_context.randrange(100)}, | ||||||||
| .fRelevantServices=random_context.randbool(), | ||||||||
| .m_relay_txs=random_context.randbool(), | ||||||||
| .fBloomFilter=random_context.randbool(), | ||||||||
| .nKeyedNetGroup=random_context.randrange(100), | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Blocking: Missing prerequisite: bitcoin#29625 bitcoin#30397 was applied on top of upstream's bitcoin#29625 pre-state. Upstream bitcoin#30397 changes Policy gate (backport-prereq-restore): For full upstream backport PRs, a missing prerequisite is blocking unless the finding is explicitly allowlisted (e.g.
Suggested change
source: ['codex-backport-reviewer'] |
||||||||
| .prefer_evict=random_context.randbool(), | ||||||||
| .m_is_local=random_context.randbool(), | ||||||||
| .m_network=ALL_NETWORKS[random_context.randrange(ALL_NETWORKS.size())], | ||||||||
| .m_noban=false, | ||||||||
| .m_conn_type=ConnectionType::INBOUND, | ||||||||
| }); | ||||||||
| } | ||||||||
| return candidates; | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,6 +40,7 @@ | |||||||||||||||||||||||
| wait_until_helper, | ||||||||||||||||||||||||
| p2p_port, | ||||||||||||||||||||||||
| get_chain_folder, | ||||||||||||||||||||||||
| tor_port, | ||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| BITCOIND_PROC_WAIT_TIMEOUT = 60 | ||||||||||||||||||||||||
|
|
@@ -90,8 +91,11 @@ def __init__(self, i, datadir, extra_args_from_options, *, chain, rpchost, timew | |||||||||||||||||||||||
| self.cwd = cwd | ||||||||||||||||||||||||
| self.mocktime = mocktime | ||||||||||||||||||||||||
| self.descriptors = descriptors | ||||||||||||||||||||||||
| self.has_explicit_bind = False | ||||||||||||||||||||||||
| if extra_conf is not None: | ||||||||||||||||||||||||
| append_config(datadir, extra_conf) | ||||||||||||||||||||||||
| # Remember if there is bind=... in the config file. | ||||||||||||||||||||||||
| self.has_explicit_bind = any(e.startswith("bind=") for e in extra_conf) | ||||||||||||||||||||||||
|
coderabbitai[bot] marked this conversation as resolved.
|
||||||||||||||||||||||||
| # Most callers will just need to add extra args to the standard list below. | ||||||||||||||||||||||||
| # For those callers that need more flexibity, they can just set the args property directly. | ||||||||||||||||||||||||
| # Note that common args are set in the config file (see initialize_datadir) | ||||||||||||||||||||||||
|
|
@@ -227,6 +231,17 @@ def start(self, extra_args=None, *, cwd=None, stdout=None, stderr=None, **kwargs | |||||||||||||||||||||||
| if extra_args is None: | ||||||||||||||||||||||||
| extra_args = self.extra_args | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Comment on lines
231
to
233
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Useful? React with 👍 / 👎. |
||||||||||||||||||||||||
| # If listening and no -bind is given, then dashd would bind P2P ports on | ||||||||||||||||||||||||
| # 0.0.0.0:P and 127.0.0.1:<default onion-service target port> (for incoming Tor connections), where P is | ||||||||||||||||||||||||
| # a unique port chosen by the test framework and configured as port=P in | ||||||||||||||||||||||||
| # dash.conf. To avoid collisions on default onion target port, change it to | ||||||||||||||||||||||||
| # 127.0.0.1:tor_port(). | ||||||||||||||||||||||||
| will_listen = all(e != "-nolisten" and e != "-listen=0" for e in extra_args) | ||||||||||||||||||||||||
| has_explicit_bind = self.has_explicit_bind or any(e.startswith("-bind=") for e in extra_args) | ||||||||||||||||||||||||
|
Comment on lines
+239
to
+240
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||||||||||||||||||||||||
| if will_listen and not has_explicit_bind: | ||||||||||||||||||||||||
| extra_args.append(f"-bind=0.0.0.0:{p2p_port(self.index)}") | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a test opts out with Useful? React with 👍 / 👎. |
||||||||||||||||||||||||
| extra_args.append(f"-bind=127.0.0.1:{tor_port(self.index)}=onion") | ||||||||||||||||||||||||
|
knst marked this conversation as resolved.
Comment on lines
+239
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: Implicit -bind injection ignores --dashd-extra-args (extra_args_from_options)
Suggested change
source: ['codex'] There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in this update — Implicit -bind injection ignores --dashd-extra-args (extra_args_from_options) no longer present. Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread.
Comment on lines
231
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Suggestion: start() mutates caller's extra_args list — shared-reference footgun Carried forward from the prior review at 314e0a3 and still valid at 086d42e. When Correction note: this is a suggestion, not a backport-prerequisite blocker; the earlier policy-gate text on this comment was incorrect. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still present at There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correction: this prior finding is STILL VALID at Updated after canonical verifier reconciliation for commit 955f92d.
Comment on lines
231
to
+243
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Superseded duplicate This inline comment duplicated the carried-forward There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolved in this update — Prior finding still valid: start() mutates caller-owned extra_args no longer present. Auto-resolved by the review system based on the latest commit diff. If you believe this was closed in error, reopen the thread. |
||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| self.use_v2transport = "-v2transport=1" in extra_args or (self.default_to_v2 and "-v2transport=0" not in extra_args) | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| # Add a new stdout and stderr file each time dashd is started | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
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.
When
-listenonion=1is used together with a normal-bindbut no-bind=...=onion, this branch points the auto-created onion service at the normal bind while leavingconnOptions.onion_bindsempty.CConnman::Init()copies onlyonion_bindsintom_onion_binds, and accepted peers are classified as inbound onion only when their local bind address is in that vector, so Tor peers arriving through this onion service are reported and handled as ordinary local/IP inbound peers. Please either keep a dedicated onion bind for this path or emit a startup warning requiring an explicit=onionbind for accurate onion accounting.Useful? React with 👍 / 👎.