-
Notifications
You must be signed in to change notification settings - Fork 288
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
multi: Add initialstate peer messages. #2349
Conversation
efe39e7
to
4204cb1
Compare
a42b2ac
to
aceef3f
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.
Really great job overall! The only thing I see are just consistency. casting, and unneeded call nits. Comments inline.
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.
Updates reviewed and look good. Thanks!
This adds the GetInitState and InitState messages along with appropriate tests. It also adds a new protocol version (version 8) and bumps the current wire version to it. This set of messages will be used to allow peers to exchange ephemeral startup information in a more general manner than the current existing GetMiningState/MiningState pair. In particular, peers will be able to selectively request only the specific startup info they're insterested in so that different types of nodes (such as SPV clients) may only request relevant startup information. Compared to the existing MiningState message, the InitState message already offers a new type of data: tspend hashes, that nodes may use to fetch tspend transactions for inspecting, generating templates and voting on their approval.
This modifies the peer package to handle GetInitState/InitState messages by adding the appropriate listeners. It also bumps the max supported protocol version to version 8, which is needed to be able to decode the messages. Note this modifies the peer package's go.mod to use the local copy of the wire module in order to have access to the new messages.
This changes the server to support the most recent protocol version (v8 or InitStateVersion). On this version, instead of using the getminingstate/miningstate pair of messages, peers use getinitstate/initstate messages which allow for finer grained control over what information is sent upon startup. The older protocol versions are still supported so that the node may continue to both request and serve initial mining state to older nodes of the network.
813b816
to
cf277fd
Compare
Rebased on top of
#2170#2350Includes #2348This is part of the treasury decentralization work.
This adds a new pair of messages to the peer protocol named
getinitstate/initstate
. These messages are meant to be used as replacements for thegetminingstate/miningstate
messages.The new messages are more generic and meant to be used for both the existing mining information (head blocks and votes) and other ephemeral data that nodes of the peer network might need. The initial implementation in dcrd additionally offers and responds with treasury spend transactions.
tpends are special transactions in that they are meant to be long-lived in the mempool and not only miner nodes but also voting wallet nodes need to discover them in a timely manner. Thus we introduce this new set of messages in order to relay them in the network as nodes startup.
This work isn't strictly consensus-related and thus has been extracted from the main treasury PR to ease review by external developers.