-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
vasild
left a comment
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 2b9cd5f7b6c0cba03da7b234eb638296eeb05cfa
mzumsande
left a comment
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
vasild
left a comment
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().
| if (fRelay) pfrom.m_relays_txs = true; | ||
| } | ||
|
|
||
| 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
vasild
left a comment
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 1597210a6d244927651b6a4b573b884cc6f9236c
1597210 to
58786a1
Compare
mzumsande
left a comment
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 58786a102ae716332c2d56a00a10726fb7e305f1
src/net_processing.cpp
Outdated
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.
ariard
left a comment
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.
src/node/txreconciliation.cpp
Outdated
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. |
ariard
left a comment
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 d44438c7
Note the new commit d44438c reodering functional tests for readability.
|
The cumulative diff as of d44438c7d7b98d790052f8848de4aaa6d0ea7704 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. |
vasild
left a comment
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.
mzumsande
left a comment
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
Non-trivial changes include:
sendtxrcnclmessage (summarized in the BIP PR);sendtxrcnclalthough we are inblocksonlyand notified the peer withfRelay=0;sendtxrcnclto feeler connections.