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
fix: reject message (de)serialization #939
Conversation
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.
FWIW, looks good to me.
I was surprised that this PR passed CI, I thought we had GitHub configured to ensure every patch passed but the first patch adds a failing test? |
The CI tests doesn't test every commit if you push them together. |
Oh, awesome. Thanks for the explanation. |
CommandString is (de)serialized as 12 bytes. However, BIP-61 defines the 'response-to-msg' (message that triggered the reject) field to be a var_str [1]. [1]: https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki#common-payload
This adds tests for the previously untested reject message (de)serialization. The two reject messages were received from an older Bitcoin Core peer that still sends reject messages.
130ffd4
to
fc572ab
Compare
Wasn't aware of the bisecting policy, but makes sense. Swaped the commits (fix, then test) and edited the commit description and the OP. |
Thanks @0xB10C, this all looks good to me. Don't be surprised if this doesn't merge for a few days while 0.28 is being released. |
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 548725c
Since this is a bugfix I think we ought to slip it into 0.28.0. (On the other hand let's not hold up 0.28.0 for it.)
Oops, we could've gotten this into 0.28, but I missed the second ACK, sorry. Too many github notifications.. |
@0xB10C how important is this bugfix to you? Should we try to push out a minor rev quickly? (Right now that's possible but might not be in a few hours, depending what we merge.) |
not important, but thanks for asking! I'm using a custom branch with this and a few other changes atm anyway. |
…ation 548725c test: reject message (de)serialization (0xb10c) fc572ab fix: use var_str in 'reject' msgs (0xb10c) Pull request description: [BIP-61 defines `response-to-msg`][bip61] (`Reject::message` in rust-bitcoin; the message that triggered the reject) to be a `var_str`. However, by using the `CommandString` it was (de)serialized as 12 byte string. A test is added that de- and serializes two reject messages received from an older Bitcoin Core peer. Reject message sending has been removed from Bitcoin Core, I'm still receiving them from older peers from time to time. [bip61]: https://github.com/bitcoin/bips/blob/master/bip-0061.mediawiki#common-payload gh-ref: rust-bitcoin/rust-bitcoin#323 ACKs for top commit: apoelstra: ACK 548725c Tree-SHA512: e5cbf215a471f113b4dd7f7fada162686fc6e8c7b1e2e9e641667208a36d3db610e57e8b549756ffe597656fee5444fe95466f1b88f45366595766f7c4640eea
BIP-61 defines
response-to-msg
(Reject::message
in rust-bitcoin; the message that triggered the reject) to be avar_str
. However, by using theCommandString
it was (de)serialized as 12 byte string. A test is added that de- and serializes two reject messages received from an older Bitcoin Core peer.Reject message sending has been removed from Bitcoin Core, I'm still receiving them from older peers from time to time.
gh-ref: #323