-
Notifications
You must be signed in to change notification settings - Fork 37.7k
p2p: Erlay support signaling follow-ups #26359
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
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. 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. |
15962a8
to
0ba8bd1
Compare
885e8f9
to
2b9cd5f
Compare
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.
Approach ACK 2b9cd5f
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.
Approach ACK
I reviewed the code, and all points I found were already mentioned by others, so I'd be happy to ACK after the oustanding comments are addressed.
8a0175a
to
23e347d
Compare
23e347d
to
2193344
Compare
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 2193344 modulo the failing test which seems to need some tweaking and the comment below wrt assert()
.
@@ -3273,17 +3273,14 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type, | |||
|
|||
if (greatest_common_version >= WTXID_RELAY_VERSION && m_txreconciliation) { |
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.
Not sure if that is better, just an idea, feel free to ignore:
diff --git i/src/net_processing.cpp w/src/net_processing.cpp
index 376a263183..0ed7781b2c 100644
--- i/src/net_processing.cpp
+++ w/src/net_processing.cpp
@@ -3265,26 +3265,27 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
(fRelay || (peer->m_our_services & NODE_BLOOM))) {
auto* const tx_relay = peer->SetTxRelay();
{
LOCK(tx_relay->m_bloom_filter_mutex);
tx_relay->m_relay_txs = fRelay; // set to true after we get the first filter* message
}
- if (fRelay) pfrom.m_relays_txs = true;
- }
-
- if (greatest_common_version >= WTXID_RELAY_VERSION && m_txreconciliation) {
- // Per BIP-330, we announce txreconciliation support if:
- // - protocol version per the peer's VERSION message supports WTXID_RELAY;
- // - transaction relay is supported per the peer's VERSION message (see m_relays_txs);
- // - this is not a block-relay-only connection and not a feeler (see m_relays_txs);
- // - this is not an addr fetch connection;
- // - we are not in -blocksonly mode.
- if (pfrom.m_relays_txs && !pfrom.IsAddrFetchConn() && !m_ignore_incoming_txs) {
- const uint64_t recon_salt = m_txreconciliation->PreRegisterPeer(pfrom.GetId());
- m_connman.PushMessage(&pfrom, msg_maker.Make(NetMsgType::SENDTXRCNCL,
- TXRECONCILIATION_VERSION, recon_salt));
+ if (fRelay) {
+ pfrom.m_relays_txs = true;
+
+ if (greatest_common_version >= WTXID_RELAY_VERSION &&
+ m_txreconciliation &&
+ !pfrom.IsAddrFetchConn() && !m_ignore_incoming_txs) {
+ // Per BIP-330, we announce txreconciliation support if:
+ // - protocol version per the peer's VERSION message supports WTXID_RELAY;
+ // - transaction relay is supported per the peer's VERSION message (see m_relays_txs);
+ // - this is not a block-relay-only connection and not a feeler (see m_relays_txs);
+ // - this is not an addr fetch connection;
+ // - we are not in -blocksonly mode.
+ const uint64_t recon_salt = m_txreconciliation->PreRegisterPeer(pfrom.GetId());
+ m_connman.PushMessage(&pfrom, msg_maker.Make(NetMsgType::SENDTXRCNCL, TXRECONCILIATION_VERSION, recon_salt));
+ }
}
}
m_connman.PushMessage(&pfrom, msg_maker.Make(NetMsgType::VERACK));
// Potentially mark this peer as a preferred download peer.
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.
Not sure about this — it's kinda difficult either way :) Will see what others say.
2193344
to
1597210
Compare
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 1597210
1597210
to
58786a1
Compare
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.
Code Review ACK 58786a1
// - we are not in -blocksonly mode. | ||
if (pfrom.m_relays_txs && !m_ignore_incoming_txs) { | ||
if (pfrom.m_relays_txs && !pfrom.IsAddrFetchConn() && !m_ignore_incoming_txs) { |
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.
Not a big fan of special casing behavior for AddrFetch
without any tangible benefits (or are there any?) - I'd like to think of them as normal outbound connections, where we just happen to disconnect after we get the GETADDR answer, and while I admit that concerns such as #26396 (comment) aren't super strong, I think it's also easier mental model and less complicated code not to special-case for each message whether AddrFetch connections need it.
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 58786a1
Verified the test coverage updates in removal of initiator/responder and after defining better sendtxrcncl
policy.
@@ -39,7 +39,8 @@ class TxReconciliationState | |||
* the following commits. | |||
* | |||
* Reconciliation protocol assumes using one role consistently: either a reconciliation | |||
* initiator (requesting sketches), or responder (sending sketches). This defines our role. | |||
* initiator (requesting sketches), or responder (sending sketches). This defines our role, | |||
* based on the direction of the p2p connection. |
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.
Note you have a bunch of references to the term initiator left in reconciatliation.{h,cpp}
:
src/node/txreconciliation.cpp: * initiator (requesting sketches), or responder (sending sketches). This defines our role,
src/node/txreconciliation.h: * 2. At regular intervals, a txreconciliation initiator requests a sketch from a peer, where a
src/node/txreconciliation.h: * 3. Once the initiator received a sketch from the peer, the initiator computes a local sketch,
src/node/txreconciliation.h: * 4b. If the difference was larger than estimated, initial txreconciliation fails. The initiator
src/node/txreconciliation.h: * SUCCESS. The initiator knows full symmetrical difference and can request what the initiator is
src/node/txreconciliation.h: * FAILURE. The initiator notifies the peer about the failure and announces all transactions from
It's minor, I think they can be addressed in its own commit here or in #26283 to avoid another review round.
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.
I think it makes sense to keep using the more abstract terms initiator / receiver within the txreconciliation module, even after removing it from the sendtxrcncl
message.
This feature was currently redundant (although could have provided more flexibility in the future), and already been causing confusion.
58786a1
to
d44438c
Compare
Applied clang-format everywhere. |
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.
The cumulative diff as of d44438c looks ok, but the individual commits seem somewhat messed up:
|
While doing this, add a new value: ALREADY_REGISTERED.
d44438c
to
46339d2
Compare
@vasild sorry for that mess, addressed everything without introducing behavior 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.
ACK 46339d2
🌞
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 46339d2
Did another parse of the code changes to verify there wasn't functional modification.
peer_txreconcl_version, remote_salt); | ||
switch (result) { | ||
case ReconciliationRegisterResult::NOT_FOUND: | ||
LogPrintLevel(BCLog::NET, BCLog::Level::Debug, "Ignore unexpected txreconciliation signal from peer=%d\n", pfrom.GetId()); |
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.
nit: The message could be clearer saying "Ignore sendtxrcncl received from peer". "txreconciliation signal" is a bit hand-wawy.
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.
Code Review ACK 46339d2
46339d2 test, refactor: Reorder sendtxrcncl tests for better readability (Gleb Naumenko) 14263c1 p2p, refactor: Extend logs for unexpected sendtxrcncl (Gleb Naumenko) 87493e1 p2p, test, refactor: Minor code improvements (Gleb Naumenko) 00c5dec p2p: Clarify sendtxrcncl policies (Gleb Naumenko) ac6ee5b test: Expand unit and functional tests for txreconciliation (Gleb Naumenko) bc84e24 p2p, refactor: Switch to enum class for ReconciliationRegisterResult (Gleb Naumenko) a60f729 p2p: Drop roles from sendtxrcncl (Gleb Naumenko) 6772cbf tests: stabilize sendtxrcncl test (Gleb Naumenko) Pull request description: Non-trivial changes include: - Getting rid of roles in `sendtxrcncl` message (summarized in the [BIP PR](bitcoin/bips#1376)); - Disconnect the peer if it send `sendtxrcncl` although we are in `blocksonly` and notified the peer with `fRelay=0`; - Don't send `sendtxrcncl` to feeler connections. ACKs for top commit: vasild: ACK 46339d2 ariard: ACK 46339d2 mzumsande: Code Review ACK 46339d2 Tree-SHA512: b5cc6934b4670c12b7dbb3189e739ef747ee542ec56678bf4e4355bfb481b746d32363c173635685b71969b3fe4bd52b1c8ebd3ea3b35c82044bba69220f6417
Non-trivial changes include:
sendtxrcncl
message (summarized in the BIP PR);sendtxrcncl
although we are inblocksonly
and notified the peer withfRelay=0
;sendtxrcncl
to feeler connections.