10000 BIP339: Add wtxidrelay message and WTx inv type by jrawsthorne · Pull Request #446 · rust-bitcoin/rust-bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

BIP339: Add wtxidrelay message and WTx inv type #446

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

Merged
merged 1 commit into from
Oct 26, 2020

Conversation

jrawsthorne
Copy link
Contributor

BIP339 support was just merged into core: bitcoin/bitcoin#18044

Not sure about changing the protocol version because I don't think every protocol is supported in rust-bitcoin yet
Not sure about the name for the new inv type, we already have WitnessTransaction

Copy link
Contributor
@ariard ariard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment on protocol versions but thanks for adding support.

@@ -42,7 +42,7 @@ use std::{fmt, io, ops};
use consensus::encode::{self, Encodable, Decodable};

/// Version of the protocol as appearing in network message headers
pub const PROTOCOL_VERSION: u32 = 70001;
pub const PROTOCOL_VERSION: u32 = 70016;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't signal wtxid-relay version, your peer won't start to talk wtxid-relay with you. But if we upgrade PROTOCOL_VERSION, downstream software need to implement wtxid-relay to avoid interferences while talking with Core. Once more we should copy undocumented const from upstream (src/version.h) and implementation should set PROTOCOL_VERSION to what features set they support.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add some docs here about this number? I thought it was a result of ORing flags, but I see that also in bitcoin core it's hard coded like that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point about forcing downstream to implement it, I'll change it back to 70001.
What sort of docs were you thinking? Telling people to change it to reflect the features they support or how it's derived?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But if we upgrade PROTOCOL_VERSION, downstream software need to implement wtxid-relay to avoid interferences while talking with Core

I don't think this is true? If you don't send the "wtxidrelay" message the only change is that you'll receive a new unknown message type, which is fine. IIUC, the only reason the protocol version was bumped here was that the message happens between version and verack and some folks may fail the connection for such messages.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the real confusion here is that the new PROTOCOL_VERSION has nothing to do with wtxidrelay - it really means "I support receiving support messages between version and verack". It just so happens that one such message is wtxidrelay.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit unclear what version this library should set as it really depends on the functionality of the software using it. Would you be ok leaving it as it is and adding a comment similar to the one I've added?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I think maybe having a PROTOCOL_VERSION constant in the crate is a bit of a misnomer - originally PROTOCOL_VERSION implied messages and features supported, but these days it really only indicates breaking changes to the protocol (ie in this case sending messages between version and verack), whereas new features are introduced by simply sending new message types which old nodes will ignore. Its probably best to just add a list of protocol versions with detailed descriptions of what they imply, though I don't think we need to go back to 0, just add the few most recent ones.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the downside I just realized for this constant here, is that you get alert messages from peers (because it's smaller than 70012)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't we (in a separate PR) remove the constant, use a hard-coded one for getheaders and getblocks and take the version for the version message as an argument from the user?

@ariard
Copy link
Contributor
ariard commented Aug 20, 2020

Code Review ACK 8c066e8.

Thanks @jrawsthorne for clarifying PROTOCOL_VERSION usage.

@jrawsthorne
Copy link
Contributor Author

Rebased

@stevenroose
Copy link
Collaborator

Could you perhaps squash?

@jrawsthorne
Copy link
Contributor Author

Squashed @stevenroose

Copy link
Collaborator
@stevenroose stevenroose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stevenroose stevenroose added the API break This PR requires a version bump for the next release label Oct 9, 2020
Copy link
Member
@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@apoelstra apoelstra merged commit c16053a into rust-bitcoin:master Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API break This PR requires a version bump for the next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0