Skip to content

Conversation

maflcko
Copy link
Member

@maflcko maflcko commented Oct 24, 2022

Should fix #26364

I can't reproduce this, but my guess would be that PeerNoVerack::on_version, which sends the wtxidrelay message, is executed in the event loop and thus may run after the main thread sending msg_verack.

Also, fix another bug.

Finally, add some assert_debug_log to ensure the right code branch is executed (and not some random, unrelated disconnect).

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 24, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.


self.log.info('SENDTXRCNCL with initiator=1 and responder=0 from outbound triggers a disconnect')
sendtxrcncl_wrong_role = create_sendtxrcncl_msg(initiator=True)
peer = self.nodes[0].add_outbound_p2p_connection(
P2PInterface(), wait_for_verack=False, p2p_idx=4, connection_type="outbound-full-relay")
peer.send_message(sendtxrcncl_wrong_role)
peer.wait_for_disconnect()
with self.nodes[0].assert_debug_log(["sendtxrcncl received after verack"]):
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is the log message we should expect here. I think should be txreconciliation protocol violation
Does it pass because this log message happened earlier?

Copy link
Member Author

Choose a reason for hiding this comment

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

P2PInterface sends a verack on the version message, so this will disconnect for the verack, not for another reason. Looks like another bug in the test?

@bitcoin bitcoin deleted a comment from Naviruiz Oct 25, 2022
peer.send_and_ping(msg_verack())
peer.send_message(create_sendtxrcncl_msg())
peer.wait_for_disconnect()
peer = self.nodes[0].add_p2p_connection(P2PInterface())
Copy link
Member

Choose a reason for hiding this comment

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

nit: worth explicitly stating wait_for_verack=True?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't really like the wait_for_verack use in this test. I think all tests here should wait for the verack. However this is currently not possible because waiting for the verack will also send a ping-pong, which obviously doesn't work. Maybe there could be another optional arg to add_p2p_connection to say skip_verack_ping_pong?

MacroFake added 2 commits October 25, 2022 13:26
Previously it disconnected due to "sendtxrcncl received after verack",
now it disconnects for the correct reason.
@maflcko
Copy link
Member Author

maflcko commented Oct 25, 2022

Fixed another bug in the last push

@naumenkogs
Copy link
Member

ACK fa3da83

@maflcko maflcko merged commit 69b1021 into bitcoin:master Oct 26, 2022
@maflcko maflcko deleted the 2210-test-race-🥒 branch October 26, 2022 10:38
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 27, 2022
fa3da83 test: Check debug log as well in p2p_sendtxrcncl.py (MacroFake)
fae0439 test: Check correct disconnect reason in p2p_sendtxrcncl.py (MacroFake)
fa590cf test: Fix intermittent issue in p2p_sendtxrcncl.py (MacroFake)

Pull request description:

  Should fix bitcoin#26364

  I can't reproduce this, but my guess would be that `PeerNoVerack::on_version`, which sends the `wtxidrelay` message, is executed in the event loop and thus may run after the main thread sending `msg_verack`.

  Also, fix another bug.

  Finally, add some `assert_debug_log` to ensure the right code branch is executed (and not some random, unrelated disconnect).

ACKs for top commit:
  naumenkogs:
    ACK fa3da83

Tree-SHA512: ee2988372223ea22e94e9783ef6d37114a3945991b6d60f0157917f3850fb7077c566564c3771d915ee74ab28202a3b73c6d89ddec6e2c918462db9a3c02e6cf
@bitcoin bitcoin locked and limited conversation to collaborators Oct 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Intermitted failure in p2p_sendtxrcncl.py
4 participants