Skip to content

net: Fix sent reject messages for blocks and transactions #7179

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 2 commits into from
Dec 10, 2015

Conversation

laanwj
Copy link
Member

@laanwj laanwj commented Dec 7, 2015

Ever since we #5913 have been sending invalid reject messages for transactions and blocks.

Ever since we bitcoin#5913 have been sending invalid reject messages
for transactions and blocks.
@dcousens
Copy link
Contributor

dcousens commented Dec 7, 2015

Worth adding a regression test?

@laanwj
Copy link
Member Author

laanwj commented Dec 7, 2015

Would make sense.

@laanwj
Copy link
Member Author

laanwj commented Dec 8, 2015

To be clear, this solves the following issue:

Normal reject message

2015-12-07 20:16:52 peer=1096 Reject tx code 64: non-final: hash 54fae12b1dc553ec56137138ad28304569c9b3a69791fca5a02664b379a7d6ba

Reject message from 0.11.99+

2015-12-04 16:07:00 peer=322 Reject tx code 66: : hash 6e6f69746361736e617274206565726620646574696d696c20657461721d0000

Reason seems empty, and part of the reason message ends up in the "hash". This is due to the reject code being sent as multiple bytes instead of one, misaligning the message.

Edit: trying to think of a test. Hopefully it could fit somewhere in the Python P2P test framework, without creating a new script.

@laanwj laanwj added this to the 0.12.0 milestone Dec 8, 2015
@maflcko
Copy link
Member

maflcko commented Dec 8, 2015

utACK 9fc6ed6

@laanwj
Copy link
Member Author

laanwj commented Dec 8, 2015

Added basic tests for rejection of blocks and transactions.
(tested that they pass with this patch, and fail without)

@laanwj laanwj force-pushed the 2015_12_fix_reject_message branch 3 times, most recently from 40811fe to 5eea9ce Compare December 8, 2015 20:29
Extend P2P test framework to make it possible to expect reject
codes for transactions and blocks.
@laanwj laanwj force-pushed the 2015_12_fix_reject_message branch from 5eea9ce to 2041190 Compare December 9, 2015 07:48
@laanwj
Copy link
Member Author

laanwj commented Dec 9, 2015

@sdaftuar Mind taking a look at the test changes?

@sdaftuar
Copy link
Member

sdaftuar commented Dec 9, 2015 via email

@laanwj laanwj merged commit 2041190 into bitcoin:master Dec 10, 2015
laanwj added a commit that referenced this pull request Dec 10, 2015
2041190 test: Add basic test for `reject` code (Wladimir J. van der Laan)
9fc6ed6 net: Fix sent reject messages for blocks and transactions (Wladimir J. van der Laan)
laanwj added a commit that referenced this pull request Dec 10, 2015
Ever since we #5913 have been sending invalid reject messages
for transactions and blocks.

test: Add basic test for `reject` code

Extend P2P test framework to make it possible to expect reject
codes for transactions and blocks.

Github-Pull: #7179
Rebased-From: 9fc6ed6 2041190
@sdaftuar
Copy link
Member

post-merge ACK. The extension to the test framework seems like a good idea!

luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Jan 10, 2016
Extend P2P test framework to make it possible to expect reject
codes for transactions and blocks.

Github-Pull: bitcoin#7179
Rebased-From: 2041190
luke-jr pushed a commit to luke-jr/bitcoin that referenced this pull request Jan 10, 2016
Extend P2P test framework to make it possible to expect reject
codes for transactions and blocks.

Github-Pull: bitcoin#7179
Rebased-From: 2041190
@laanwj
Copy link
Member Author

laanwj commented Feb 4, 2016

This is cherry-picked to 0.12 as 44fef99, removing needs backport label

zkbot added a commit to zcash/zcash that referenced this pull request Aug 17, 2021
ZIP 239 preparations 4

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#5913
  - Replaces #3111.
  - Includes an extra commit included by upstream in the merge outside the PR.
- bitcoin/bitcoin#6519
- bitcoin/bitcoin#7179
- bitcoin/bitcoin#7853
- bitcoin/bitcoin#7960
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants