Skip to content

test: Wait until is_connected in add_p2p_connection - #19657

Merged
laanwj merged 1 commit into
bitcoin:masterfrom
maflcko:2008-testWaitConn
Aug 9, 2020
Merged

laanwj merged 1 commit into
bitcoin:masterfrom
maflcko:2008-testWaitConn

Conversation

@maflcko

@maflcko maflcko commented Aug 4, 2020

Copy link
Copy Markdown
Member

Moving the wait_until from the individual test scripts to the test framework simplifies two tests

@maflcko maflcko added the Tests label Aug 4, 2020
@maflcko

maflcko commented Aug 4, 2020

Copy link
Copy Markdown
Member Author

@maflcko
maflcko force-pushed the 2008-testWaitConn branch from fa9c81c to fa4dfd2 Compare August 4, 2020 14:13

@theStack theStack left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK fa4dfd2 ☕
Code-reviewed, checked that all now redundant wait-for-connection constructs (wait_until(... .is_connected, ...)) after add_p2p_connection(...) in other tests were tackled and ran the functional tests locally.

@jnewbery jnewbery left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Concept ACK. One question inline


# Node that never sends a version. We'll use this to send a bunch of messages
# anyway, and eventually get disconnected.
class CNodeNoVersionMisbehavior(CLazyNode):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any reason not to remove this class entirely?

@jnewbery

jnewbery commented Aug 6, 2020

Copy link
Copy Markdown
Contributor

Code review ACK fa4dfd2

We should consider removing CNodeNoVersionMisbehavior either here or in a follow-up.

@laanwj
laanwj merged commit 5e4fed9 into bitcoin:master Aug 9, 2020
@maflcko
maflcko deleted the 2008-testWaitConn branch August 14, 2020 16:15
fanquake added a commit that referenced this pull request Aug 20, 2020
ed5cd12 test: Distinguish between nodes(bitcoind) and peers(mininodes) in p2p_leak.py (Dhruv Mehta)
f6f082b test: remove `CNodeNoVersionIdle` from p2p_leak.py (Dhruv Mehta)
45cf55c test: remove `CNodeNoVersionMisbehavior` from p2p_leak.py (Dhruv Mehta)

Pull request description:

  - Removes `CNodeNoVersionMisbehavior` per recommendation at #19657 (comment)
  - Removes `CNodeNoVersionIdle` because it is similarly unnecessary
  - As someone new to the codebase, I found it easier to understand it if `no_version_disconnect_node` tries to overwhelm the peer with any message that is not version/verack.
  - Per recommendation at #19727 (review), made a clear distinction between nodes(bitcoind) and peers(mininode interface implementations)

ACKs for top commit:
  jnewbery:
    tested ACK ed5cd12
  amitiuttarwar:
    utACK ed5cd12

Tree-SHA512: 310a24c91fd837e7f65177edb55fe6142fb3559fae7867c5cdd9c9a23b1a02202b935ca9a82633fa7649f3de2fa221f6da906a7b5e499fc20f7254085033757d
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 7, 2021
Summary:
The discouragement threshold is modified to account for the change in D6036, which caused a peer to be banned after only 10 out-of-order messages instead of 100.

Using the wrong value in this test could potentially cause the node to be banned before all messages are sent, and cause the next `self.send_message(msg_verack())` to break the test, because this method fails when trying to send a message if the connection is closed.

I observed this failure while trying [[bitcoin/bitcoin#19657 | core#19657]]  (D10063), in which the message is sent a bit later in the test and the node bans the p2p connection faster.

Test Plan: `test/functional/test_runner.py p2p_leak`

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Subscribers: majcosta

Differential Revision: https://reviews.bitcoinabc.org/D10064
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 7, 2021
Summary:
Moving the wait_until from the individual test scripts to the test framework simplifies two tests

This is a backport of [[bitcoin/bitcoin#19657 | core#19657]]

Depends on D10064

Test Plan: `ninja check-functional-extended`

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D10063
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
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.

4 participants