dash/test/functional/test_framework
Alexander Block 91b4a38398 Backport bitcoin#11773: [tests] Change feature_block.py to use BitcoinTestFramework (#3277)
* [tests] Change feature_block.py to use BitcoinTestFramework

* [tests] Fix flake8 warnings in feature_block.py

* [tests] Tidy up feature_block.py

- move all helper methods to the end
- remove block, create_tx and create_and_sign_tx shortcuts
- remove --runbarelyexpensive option, since it defaults to True and it's
unlikely that anyone ever runs the test with this option set to false.

* [tests] Add logging to feature_block.py

* [tests] Improve assert message when wait_until() fails

* Merge #13048: [tests] Fix feature_block flakiness

c1d742025c [tests] Fix feature_block flakiness (John Newbery)

Pull request description:

  feature_block.py occasionally fails on Travis. I believe this is due to
  a a race condition when reconnecting to bitcoind after a subtest that
  expects disconnection. If the test runs ahead and sends the INV for the
  subsequent test before we've received the initial sync getheaders, then
  we may end up sending two headers messages - one as a response to the
  initial sync getheaders and one in response to the INV getheaders. If
  both of those headers fail validation with a DoS score of 50 or higher,
  then we'll unexpectedly be disconnected.

  There is only one validation failure that has a DoS score bewteen 50 and
  100, which is high-hash. That's why the test is failing immediately
  after the "Reject a block with invalid work" subtest.

  Fix is to wait for the initial getheaders from the peer before we
  start populating our blockstore. That way we won't have any invalid
  headers to respond to it with.

Tree-SHA512: dc17d795fcfaf0f8c0bf1e9732b5e11fbc8febbfafba4c231b7c13a5404a2c297dcd703a7a75bc7f353c893e12efc87f424f2201abd47ba5268af32d4d2e841f

* Temporarely rename MAX_BLOCK_SIZE -> MAX_BLOCK_BASE_SIZE

We'll undo this after the next commit. This avoids merge many conflicts and
makes reviewing easier.

* Rename MAX_BLOCK_BASE_SIZE back to MAX_BLOCK_SIZE

* Use DoS score of 100 for bad-blk-sigops

This was accidently changed to 10 while backporting bitcoin#7287 and causes
test failures in p2p-fullblocktest.py

* Use allowOptimisticSend=true when sending reject messages

This fixes test failures in p2p-fullblocktest.py which expects reject
messages to be sent/received before connections get closed.

* Fix p2p-fullblocktest.py

- CBlock and friends are still in test_framework.mininode
- "-whitelist" causes connections to not be dropped, which in turn causes
  sync_blocks with reconnect=True to fail
- "bad-cb-amount" does not cause a ban in Dash, so reconnect must be False
- Dash already bans when a header is received which is a child of an invalid
  header, causing block requests to never happen

* Backport missing changes from bitcoin#13003

bitcoin#13003 was backported out of order which causes missed changes.

* Bump p2p-fullblocktest timeouts

* Increase RPC timeout in p2p-fullblocktest.py

Co-authored-by: John Newbery <jonnynewbs@gmail.com>
Co-authored-by: MarcoFalke <falke.marco@gmail.com>
2020-01-11 04:31:25 +03:00
..
__init__.py Merge bitcoin#9956: Reorganise qa directory (#2912) 2019-05-19 23:20:34 +03:00
authproxy.py Merge #11277: Fix uninitialized URI in batch RPC requests 2019-09-30 08:33:16 +02:00
bignum.py Merge #10781: Python cleanups 2020-01-02 22:01:29 -06:00
blockstore.py Merge #10781: Python cleanups 2020-01-02 22:01:29 -06:00
blocktools.py Merge bitcoin#9956: Reorganise qa directory (#2912) 2019-05-19 23:20:34 +03:00
comptool.py Merge #11068: qa: Move wait_until to util 2019-09-24 16:58:03 +02:00
coverage.py Merge #11277: Fix uninitialized URI in batch RPC requests 2019-09-30 08:33:16 +02:00
key.py Merge bitcoin#9956: Reorganise qa directory (#2912) 2019-05-19 23:20:34 +03:00
mininode.py Merge #10781: Python cleanups 2020-01-02 22:01:29 -06:00
netutil.py Merge #10781: Python cleanups 2020-01-02 22:01:29 -06:00
script.py Merge #10781: Python cleanups 2020-01-02 22:01:29 -06:00
siphash.py Merge bitcoin#9956: Reorganise qa directory (#2912) 2019-05-19 23:20:34 +03:00
socks5.py Merge #10781: Python cleanups 2020-01-02 22:01:29 -06:00
test_framework.py Show quorum connections in "quorum dkgstatus" and use it in mine_quorum (#3271) 2020-01-08 08:01:26 +01:00
test_node.py Merge #14413: tests: Allow closed rpc handler in assert_start_raises_init_error (#3157) 2019-10-17 11:59:21 +02:00
util.py Backport bitcoin#11773: [tests] Change feature_block.py to use BitcoinTestFramework (#3277) 2020-01-11 04:31:25 +03:00