HomePhabricator

sync_with_ping should assert that ping hasn't timed out

Description

sync_with_ping should assert that ping hasn't timed out

Summary:
This backport core's PR10114

Depends on D968

From 2d353cf194ab00a9e569a2067ddc141c816b4c2a :

Add send_await_disconnect() method to p2p-compactblocks.py

p2p-compactblocks was incorrectly using sync_with_ping() when sending in
invalid block. The node would disconnect us and never respond to the
ping, so the sync_with_ping would just time out after 30 seconds and
continue with the test.

This commit adds a send_await_disconnect() method that sends the
message, and then waits for the node to disconnect us. In this commit
I've added the method to p2p-compactblocks.py, but a future commit could
move it to mininode since it could be useful more generally.

This commit reduces the p2p-compactblock runtime by 30 seconds.

From 8d55c24eadab5033bf931b4e3b4c162e7c58990c :

[tests] sync_with_ping should assert that ping hasn't timed out

sync_with_ping currently returns false if the timeout expires, and it is
the caller's responsibility to fail the test. However, none of the tests
currently assert on sync_with_ping()'s return code. This commit adds an
assert to sync_with_ping so the test will fail if the timeout expires.

This commit also removes all the duplicate implementations of
sync_with_ping() from the individual tests.

Test Plan:

make check
./test/functional/test_runner.py

Reviewers: #bitcoin_abc, schancel

Reviewed By: #bitcoin_abc, schancel

Differential Revision: https://reviews.bitcoinabc.org/D977

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Mar 29 2017, 18:16
deadalnixCommitted on Jan 19 2018, 15:26
deadalnixPushed on Jan 19 2018, 15:26
Reviewer
Restricted Project
Differential Revision
D977: sync_with_ping should assert that ping hasn't timed out
Parents
rABCfe14ea286e6d: Save watch only key timestamps when reimporting keys
Branches
Unknown
Tags
Unknown