Optional checksum rebase#26
Open
sickpig wants to merge 13 commits into
Open
Conversation
This function will take an enum (cast to uint64_t) and a map of bit values to strings and produce a string describing the OR-ed enum value. To be used in the following xversion commits.
A version value of 10300 is below the MIN_PEER_PROTO_VERSION, which will generate an error already further up in the code.
This is a proposal and implementation for augmenting the `version` message in the BCH protocol with an `xversion` message to provide a key value map of 64bit integers to `std::vector<uint8_t>` values (called `xmap`) that can be used to signal general configuration and version options to connected peers. This implementation comes with a specification document in doc/xversionmessage.md, a simple unit test and a fuzzer test case. It also comes with a proposal on how to organize and name the `xmap` key space between implementations, as well as a tool to process a key space definition file (xversionkeys.dat) into a C++ header. Furthermore, the BU-specific BUVERSION message has been retired (but is still handled) and replaced with an appropriate entry in this map. Thanks to everyone who gave me input on this PR: @gandrewstone, @Greg-Griffith, @dgenr8, @sickpig, @dagurval, @jasonbcox, @schancel, @deadalnix
This is a rather comprehensive rework of the initial connection set up logic. Instead of having various flags that track the individual sending and receiving of messages, the set up sequencing for a connection has been replaced with two state machines and corresponding state variables (state_incoming, state_outgoing) that track the status of the incoming and outgoing connection setup parts, and of sending any kind of version message (version, buversion, xversion) around. This change comes with a few behavioral changes and thus needs to be tested comprehensively in a test net as well as live nodes for reasonable certainty as to bug scarcity. The incoming and outgoing state variables and their allowed transitions are as follows: For INCOMING versioning message from the remote peer, using the ConnectionStateIncoming enum as defined in net.h: CONNECTED_WAIT_VERSION: Initial state. The TCP connection is up and the node is waiting for the version message from the remote peer. Only a version message is valid here. All other messages are invalid and will either lead to disconnection and banning or are silently ignored. SENT_VERACK_READY_FOR_XVERSION: After receiving the version message (and sending the verack out in the event handler). Only now it is permissible to receive and extended version message 'xversion' from the remote peer. If any other message comes in, the state transitions to READY automatically, which will make receipt of xversion messages invalid. READY: The version handshake is complete and normal message exchange can commence. For OUTGOING versioning messages to the remote peer, using the ConnectionStateOutgoing enum as defined in net.h: CONNECTED: Initial state after TCP connection is up. SENT_VERSION: The initial version message has been sent to the remote peer. READY: The verack has been received and the buversion as well as xversion messages have been sent to the remote peer. Any regular message that is coming in the initial version message, before both incoming and outgoing connection state transitioned to "READY" will be dropped now.
Only enable parallel message processing when all version information has been exchanged.
Allow to set the pushbuf argument also in the send_message(..)s methods that build on top of the basic one.
To allow for accessing files other than the log file in a node's working directory as well.
There's some duplicated code handling with the compact integer format that can now be reworked to use this implementation. However, this commit doesn't contain the rework yet - it just adds one more implementation ...
Add xversion / xverack messages to mininode and handle their receipt in a simply but likely sufficient way. No changes have been made to the sending side of the mininode in here.
Wait for proper xversion setup before testing the sendheaders functionality.
… rework locking for parallelism
35c3f80 to
82956b1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.