-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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
net: Add and document network messages in protocol.h #7181
Conversation
@jonasschnelli second commit moves your logAllowIncomingMsgCmds to protocol.cpp, I think this makes sense to have everything related to message types together. |
2746d63
to
dbbdb27
Compare
@@ -140,3 +172,9 @@ std::string CInv::ToString() const | |||
{ | |||
return strprintf("%s %s", GetCommand(), hash.ToString()); | |||
} | |||
|
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.
Is this double newline supposed to be here? I noticed it earlier in the file too (unrelated to 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.
No ,not on purpose, will remove it
Careful Code Review ACK. |
utACK, I was thinking about how we needed this today! |
dbbdb27
to
68a3b9f
Compare
ACK |
ut ACK Cosmetic nit: It would be nice to break up allNetMessageTypes[] into one-per-line in the source code, permitting a more simple future patch of
versus
for future patch readability and simplicity. |
er... why? |
Note, PR bitcoin-dot-org/Bitcoin.org#1154 has been opened in the Bitcoin.org repository to add brief sendheaders documentation at the URL referenced in this PR. Thanks! |
NET_MSG_NOTFOUND, NET_MSG_FILTERLOAD, NET_MSG_FILTERADD, NET_MSG_FILTERCLEAR, NET_MSG_REJECT, | ||
NET_MSG_SENDHEADERS | ||
}; | ||
const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes+ARRAYLEN(allNetMessageTypes)); |
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.
1 day, initializer lists.
utACK f5b1d97 (and verified consistent constant usage). Agreed this will make grepping way easier, plus it documents each command with clear entry points for new features etc. |
Is there anything unclear from the opening post?
Makes sense. |
2e5ecc1
to
985ac4b
Compare
Rebased and squashed after #7180 |
@theuni Hope this doesn't collide with your P2P work? |
Any opinion on putting the constants in a namespace instead of |
+1! |
Agree with using a namespace instead of the |
@laanwj hmm ok utACK 399551f2c246844f8a8c4994142c6e04bf283778 |
@laanwj Yes - we should start using namespaces. IMO first step is Bitcoin:: and second step is Net:: under that. |
reACK 399551f |
- Avoids string typos (by making the compiler check) - Makes it easier to grep for handling/generation of a certain message type - Refer directly to documentation by following the symbol in IDE - Move list of valid message types to protocol.cpp: protocol.cpp is a more appropriate place for this, and having the array there makes it easier to keep things consistent.
399551f
to
9bbe71b
Compare
utACK. Thanks! |
9bbe71b net: Add and document network messages in protocol.h (Wladimir J. van der Laan)
- Avoids string typos (by making the compiler check) - Makes it easier to grep for handling/generation of a certain message type - Refer directly to documentation by following the symbol in IDE - Move list of valid message types to protocol.cpp: protocol.cpp is a more appropriate place for this, and having the array there makes it easier to keep things consistent. Github-Pull: #7181 Rebased-From: 9bbe71b
…itcoin#7181: enable per-command byte counters in `CNode` (#1496) * log bytes recv/sent per command * net: Account for `sendheaders` `verack` messages Looks like these were forgotten in bitcoin#6589. * Backport remaining part of Bitcoin PR bitcoin#7181. Most of this PR is already merged, but a small part remaining that makes per-command byte counts in CNode working. Signed-off-by: Oleg Girko <ol@infoserver.lv>
* enable per-command byte counters in (#1496) * log bytes recv/sent per command * net: Account for messages Looks like these were forgotten in #6589. * Backport remaining part of Bitcoin PR bitcoin/bitcoin#7181. Most of this PR is already merged, but a small part remaining that makes per-command byte counts in CNode working. Signed-off-by: Oleg Girko <ol@infoserver.lv>
… per-command byte counters in `CNode` (#1496) * log bytes recv/sent per command * net: Account for `sendheaders` `verack` messages Looks like these were forgotten in #6589. * Backport remaining part of Bitcoin PR bitcoin/bitcoin#7181. Most of this PR is already merged, but a small part remaining that makes per-command byte counts in CNode working. Signed-off-by: Oleg Girko <ol@infoserver.lv>
… per-command byte counters in `CNode` (#1496) * log bytes recv/sent per command * net: Account for `sendheaders` `verack` messages Looks like these were forgotten in #6589. * Backport remaining part of Bitcoin PR bitcoin/bitcoin#7181. Most of this PR is already merged, but a small part remaining that makes per-command byte counts in CNode working. Signed-off-by: Oleg Girko <ol@infoserver.lv>
26b1d9e Apply clang-format (Fuzzbawls) f12f540 Add and document layer 2 network messages to protocol.h (Fuzzbawls) 7a176ed net: Add and document network messages in protocol.h (Wladimir J. van der Laan) Pull request description: Ported from bitcoin#7181 with layer 2 messages in a followup commit, then ran both commits through `clang-format-diff.py` > - Avoids string typos (by making the compiler check) > - Makes it easier to grep for handling/generation of a certain message type > - Refer directly to documentation by following the symbol in IDE > - Move list of valid message types to protocol.cpp: > protocol.cpp is a more appropriate place for this, and having > the array there makes it easier to keep things consistent. ACKs for top commit: random-zebra: Very nice. utACK 26b1d9e furszy: ACK 26b1d9e Tree-SHA512: a1d08ffb940a66b03856779180e00c212234adc8af3f175e67f694b040e426f35de2cfe6725a3bcdcb606c0468cc33e17e1882a0e2d7f657eebfdb273f0f523c
Use SipHash for node eviction Backport of bitcoin/bitcoin#8173 Commits are listed in stack order. - pick bitcoin/bitcoin@eebc232187 - pick bitcoin/bitcoin@888483098e - pick bitcoin/bitcoin@c31b24f745 - pick bitcoin/bitcoin@9bf156bb9e - pick bitcoin/bitcoin@053930ffc4 - missing bitcoin/bitcoin#5697 (not a candidate for direct inclusion), using pieces directly - conflicts with #1258 which it removes part of (this is ok) - ignore bitcoin/bitcoin#6374 - requires bitcoin/bitcoin#7906, or at least bitcoin/bitcoin@cca221fd21 - pick bitcoin/bitcoin@cca221fd21 - conflicts with bitcoin/bitcoin#7181, not needed until later if at all
@harding I've used your descriptions of the message types, hope you don't mind :)
Edit: sendheaders is not yet documented in the developer docs, this is tracked here: bitcoin-dot-org/Bitcoin.org#1153