-
Notifications
You must be signed in to change notification settings - Fork 37.7k
test: remove race in the user-agent reception check #27986
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
test: remove race in the user-agent reception check #27986
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. |
I stumbled on this playing with #27509: https://cirrus-ci.com/task/6722465808777216?logs=ci#L8761-L8771 CI log
The test calls |
44d71cf
to
9c46f3b
Compare
|
9c46f3b
to
c1a1690
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.
Light tested ACK c1a1690
c1a1690
to
28d26c4
Compare
Invalidates ACK from @jonatack |
ACK 28d26c4 |
In `add_p2p_connection()` we connect to `bitcoind` from the Python client and check that it has received our version string. This check looked up the last/newest entry from `getpeerinfo` RPC, assuming that it must be the connection we have just opened. But this will not be the case if a new inbound or outbound connection is made to/from `bitcoind` in the meantime. Instead of the last entry in `getpeerinfo`, check all and find the one which corresponds to our connection using our outgoing address:port tuple which is unique. Co-authored-by: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Co-authored-by: Jon Atack <jon@atack.com>
28d26c4
to
20b4946
Compare
Invalidates ACK from @jonatack |
Concept ACK |
re-ACK 20b4946 |
Anything further needed here? |
Concept ACK 20b4946 Probably an edge case, but it seems useful to have this in case connections are opened at the same time for some reason. |
The tests from #27509 failed because of this which prompted me to open this PR. |
In
add_p2p_connection()
we connect tobitcoind
from the Python client and check that it has received our version string.This check looked up the last/newest entry from
getpeerinfo
RPC, assuming that it must be the connection we have just opened. But this will not be the case if a new inbound or outbound connection is made to/frombitcoind
in the meantime.Instead of the last entry in
getpeerinfo
, check all and find the one which corresponds to our connection using our outgoing address:port tuple which is unique.