Commit Graph

284 Commits

Author SHA1 Message Date
MarcoFalke
00167dea54
Merge #11078: [tests] Make p2p-leaktests.py more robust
0063d2c3d [tests] Make p2p-leaktests.py more robust (John Newbery)

Pull request description:

  There has been an example of p2p-leaktests.py failing on travis in the new service bits test (introduced in #11001 . It appeared to me that the previous p2p connections had not been fully disconnected before attempting to add new p2p connections.

  I've added a sleep and restarted the NetworkThread, but I don't know whether this will fix the problem, since I'm unable to reproduce the failure locally.

  @MarcoFalke - not sure what you want to do here? I don't think this change could make things any worse.

Tree-SHA512: f5427c26267185a903c9b75bb3925bf153b8afce70c8e493bf8f585f57d809d20643b4ee69081300b211d22e960242aecc3d719f4ddd230aa08fdc5484b55055
2020-01-10 10:33:55 -06:00
MarcoFalke
b1af3b8db9
Merge #10680: Fix inconsistencies and grammar in various files
1d8df0141 Fix MD formatting in REST-interface.md and spelling mistake in test_runner.py (MeshCollider)
41f3e84aa Fix inconsistencies and grammar in various files (MeshCollider)

Pull request description:

  Just a simple fix of some inconsistent capitalization, formatting and grammar in a few files (no code changes)

Tree-SHA512: 60b12a5a5c69a1af4a25b7db0b32ed806ed62ad2966cee08b3792a7cfa7f51848fd485349b4c09e60a7eedfdf55ee730c51daa066d6e226ae404c93342bf3e13

Without RPM stuff
2020-01-10 10:33:53 -06:00
Alexander Block
9c9cac6d67
Show quorum connections in "quorum dkgstatus" and use it in mine_quorum (#3271)
Instead of statically sleeping 2 seconds
2020-01-08 08:01:26 +01:00
MarcoFalke
ef59dce92e Merge #14630: test_runner: Remove travis specific code
fa43626611 test_runner: Remove travis specific code (MarcoFalke)

Pull request description:

  The tests are no longer run on travis, but in a docker, developer machines or a windows vm.

  The code was essentially dead for months now. Fix that by explicitly passing in `--ci` to the test runner on our docker and appveyor windows vm.

Tree-SHA512: 5d48693c03e8eb27536658ccf9ba738fe93a72abd4b72c80caac084b5b2cdffa77a1031a671eeefe70b71d63500f55917803d4be54d01849722afdccb700a9e6
2020-01-07 23:12:29 +01:00
Wladimir J. van der Laan
430c0380fa Merge #13105: [qa] Add --failfast option to functional test runner
58f9a0a Use --failfast when running functional tests on Travis (James O'Beirne)
bf720c1 Add --failfast option to functional test runner (James O'Beirne)

Pull request description:

  Add the option (`--failfast`) to stop the functional test runner's execution when it encounters the first failure.

  Also cleans up run_test's arguments list ([no more mutable default for `args`](http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments)) and call site.

Tree-SHA512: e854b1b1634bf613ae8ae88e715df1460982fa68db9d785aafeb5eccf5bf324c7f20dded2ca6840ebf18a28347ecac2138d6c7592507b34939b02609ef55e1b3
2020-01-07 23:12:11 +01:00
Alexander Block
aca6af0a0e
Use smaller LLMQs in regtest (#3269)
* Rename LLMQ_5_60 to LLMQ_TEST

* Introduce -llmqtestparams which allows to modify LLMQ_TEST on regtest

Also add support in DashTestFramework

* Use parameters size=3, threshold=2 as default for LLMQ_TEST

And fall back to the old parameters where necessary

* Wait for all contributions, even when one member is lying

Otherwise we might end up continuing too fast, which would fail the DKG.

* Update src/chainparams.cpp

Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>

Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-01-07 13:49:51 +01:00
Alexander Block
88da298082 Add -whitelist to all nodes in smartfees.py (#3273)
This speeds up mempool synchronization a lot due to trickling being forced.
This will later conflict with bitcoin#16493 and bitcoin#16535, but this can
easily be resolved (it does the same).
2020-01-05 00:17:41 +03:00
Alexander Block
7e3ed76e54 Make a deep copy of extra_args before modifying it in set_dash_test_params (#3270)
Otherwise we end up having the same list instance for every entry in
extra_args, which means modifying index 0 also affects all other indexes.

Noticed this while looking at "ps aux | grep dashd" output. It turned out
that parameters like "-dip3params" were passed multiple times to each node.
2020-01-04 14:22:41 +03:00
Alexander Block
75bb7ec022 A few optimizations/speedups for Dash related tests (#3268)
* Avoid unnecessary connections in dip3-deterministicmns.py

This saves ~15 seconds

* Generate more blocks per generate() call

* Use -vbparams to activate dip8 faster in tests

Avoids generating/syncing many unnecessary blocks
2020-01-04 14:21:16 +03:00
UdjinM6
4b7c175f53
Merge pull request #3266 from PastaPastaPasta/backports-0.16-pr1-rpc
Backports 0.16 pr1-3: rpc
2020-01-03 20:49:59 +03:00
MarcoFalke
561ec27683 Merge #10781: Python cleanups
78214588d Use for-loop instead of list comprehension (practicalswift)
823979436 Use the variable name _ for unused return values (practicalswift)
2e6080bbf Remove unused variables and/or function calls (practicalswift)
9b94054b7 Avoid reference to undefined name: stderr does not exist, sys.stderr does (practicalswift)
51cb6b822 Use print(...) instead of undefined printf(...) (practicalswift)
25cd520fc Use sys.exit(...) instead of exit(...): exit(...) should not be used in programs (practicalswift)

Pull request description:

  Python cleanups:
  * Avoid reference to undefined name: `stderr` does not exist, `sys.stderr` does
  * Use `print(...)` instead of undefined `printf(...)`
  * Avoid redefinition of variable (`tx`) in list comprehension
  * Remove unused variables and/or function calls
  * Use `sys.exit(...)` instead of `exit(...)`: [`exit(...)` should not be used in programs](https://github.com/bitcoin/bitcoin/pull/10753#discussion_r125935027)

Tree-SHA512: 1238dfbc1d20f7edadea5e5406a589f293065638f6234809f0d5b6ba746dffe3d276bc5884c7af388a6c798c61a8759faaccf57f381225644754c0f61914eb4b
2020-01-02 22:01:29 -06:00
MarcoFalke
50ea6c719c PARTIAL Merge #12917: qa: Windows fixups for functional tests
(Do the rest of it after dependents are backported)

fab9095d40 qa: Windows fixups for functional tests (MarcoFalke)

Pull request description:

  Just two minor fixups to have less errors when the tests run on native windows.
  * Strip whitespace from lines when reading from a notification file
  * Instead of clumsily creating a file with weird permissions, just create a folder for the same effect in `mempool_persist.py`

Tree-SHA512: 48a8b439f14ab9b44c5cd228cd03105e8613e703e3c2951cdf724931bc95172a9ad9bfe69fc23e73dd91b058c1352263c0ac6e8de2ceb0ebf804c8ff52bba394
2020-01-02 21:59:57 -06:00
Wladimir J. van der Laan
7214f07e78 Merge #11125: Add bitcoin-cli -stdin and -stdinrpcpass functional tests
29e1dfbd9 [test] Add bitcoin-cli -stdin and -stdinrpcpass functional tests (João Barbosa)
ce379b47b [test] Replace check_output with low level version (João Barbosa)
232e3e847 [test] Add assert_raises_process_error to assert process errors (João Barbosa)
5c18a84b9 [test] Add support for custom arguments to TestNodeCLI (João Barbosa)
e1274947d [test] Improve assert_raises_jsonrpc docstring (João Barbosa)
769684132 Fix style in -stdin and -stdinrpcpass handling (João Barbosa)

Pull request description:

  This patch adds tests for `bitcoin-cli` options `-stdin` (#7550) and `-stdinrpcpass` #10997.

Tree-SHA512: fd8133f44876f2b5b41dfd3762b1988598f6b7bf13fb2385ad95876825d9c0b2b896ce4ea6eeb21012158e1f276907f155d37bb967198b609d2d3dddbfa334c1

remove duplicate method

Signed-off-by: Pasta <pasta@dashboost.org>
2020-01-02 21:59:55 -06:00
MarcoFalke
59e212eaf8 Merge #11099: [RPC][mempool]: Add savemempool RPC
1aa97ee08 Add savemempool RPC (Lawrence Nahum)
467cbbcbf Add return value to DumpMempool (Lawrence Nahum)

Pull request description:

  Adds a simple parameterless rpc command to dump the mempool.

  Rationale:

  Sometimes there can be a crash for whatever reason (bug, power loss, etc) causing the mempool.dat file to not be saved.

  This change allows to script/cron the rpc call to have more regular saves to the file as well as cli/ad-hoc.

  This should solve issue https://github.com/bitcoin/bitcoin/issues/11086

Tree-SHA512: e856ae9777425a4521279c9b58e69285d8e374790bebefd3284cf91931eac0e456f86224f427a087a01bf70440bf6e439fa02c8a34940eb1046ae473e98b6aaa

replace "assert_raises_jsonrpc" with "assert_raises_rpc_error"

Co-Authored-By: UdjinM6 <UdjinM6@users.noreply.github.com>
2020-01-02 21:59:51 -06:00
Alexander Block
7ff96c2405 A few fixes for integration tests (#3263)
* Wait a little bit longer in wallet-encryption.py

The timed wallet locking is happening by an asynchronous task internally,
which means that it might need a little bit longer then the specified
timeout.

* Add workaround for p2p-versionbits-warnings.py until we backport bitcoin#12264
2020-01-02 20:36:17 +03:00
MarcoFalke
c9b20f027f
Merge #10956: Fix typos
9d5e98ff8 Fix typos. (practicalswift)

Pull request description:

  Fix some typos not covered by #10705.

Tree-SHA512: f06e9541f6ae13ef5d6731399b61795997b21a8816abeb1749c93e99a5c47354e6cbd4a3d145f4dc6ef8a13db179799a3121ecbb7288abf3e8d81cdf81500d37
2020-01-01 21:31:39 -06:00
MarcoFalke
1ba944c55e
Merge #10705: Trivial: spelling fixes
f42fc1d50 doc: spelling fixes (klemens)

Pull request description:

  patch contains some spelling fixes ( just in comments ) as found by a bot ( http://www.misfix.org, https://github.com/ka7/misspell_fixer ).

Tree-SHA512: ba6046cfcd81b0783420daae7d776be92dd7b85a593e212f8f1b4403aca9b1b6af12cef7080d4ea5ed4a14952fd25e4300109a59c414e08f5395cdb9947bb750
2020-01-01 21:31:29 -06:00
PastaPastaPasta
2afdc8c6f6 Add basic PrivateSend RPC Tests (#3254)
* add ps test

Signed-off-by: Pasta <pasta@dashboost.org>

* remove unused import

Signed-off-by: Pasta <pasta@dashboost.org>
2019-12-31 17:22:43 +03:00
UdjinM6
7331d4edda Bump wait_for_chainlocked_block_all_nodes timeout in llmq-is-retroactive.py to 30 sec when mining lots of blocks at once (#3238) 2019-12-12 11:46:31 +01:00
Alexander Block
4c00d98ea6 Allow re-signing of IS locks when performing retroactive signing (#3219)
* Implement re-signing of InstantSend inputs when TXs come in via blocks

* Use GetAdjustedTime instead of GetTimeMillis in CSigSharesManager

This allows use of mocktime in tests.

* Expose verifiedProRegTxHash in getpeerinfo and implement wait_for_mnauth

* Allow to wait for IS and CL to NOT happen

* Bump timeout for wait_for_instantlock

* Implement tests for retroactive signing of IS and CLs

* Add wait_for_tx function to DashTestFramework

* Add -whitelist=127.0.0.1 to node0

* Use node3 for isolated block generation

* Don't test for non-receival of TXs on node4/node5
2019-12-06 12:05:58 +03:00
UdjinM6
b4b9d34675 Tests: Fix the way nodes are connected to each other in setup_network/start_masternodes (#3221)
* Tests: Connect to the control node only in start_masternodes

Masternodes should take care of intra-quorum connections themselves

* Reconnect non-masternodes back to the control node
2019-12-05 19:31:55 +01:00
UdjinM6
08f447af92 Tests: Allow specifying different cmd-line params for each masternode (#3222) 2019-12-05 19:28:33 +01:00
UdjinM6
05ac4dbb45
Dashify few strings (#3214) 2019-11-22 21:13:19 +03:00
Nathan Marley
70b320bab0 Detect masternode mode from masternodeblsprivkey arg (#3188)
* Detect masternode mode from privkey arg

The `masternode` argument seems redundant. This change enables masternode mode
based on the presence (and validity) of the `masternodeblsprivkey` argument.

* Deprecate -masternode option

* Remove -masternode switch from functional tests

* Move -masternode deprecate warning to better place
2019-11-11 12:21:45 +03:00
UdjinM6
1bbe1adb4c
Add a simple test for payoutAddress reuse in protx update_registrar (#3183) 2019-10-31 20:31:08 +03:00
UdjinM6
e0781095f0
A couple of fixes for additional indexes (#3181)
* It should not be possible to change settings for additional indexes without reindex

* Should write db flags for additional indexes on reindex

* Add tests to make sure index settings can't be changed without reindex
2019-10-31 20:30:42 +03:00
Nathan Marley
9bc699ff25 Update activemn if protx info changed (#3176)
* Update activemn if protx info changed

* Add `==` and `!=` operators to CDeterministicMNState

* Only re-init active MN if its IP changed, changes to payout, voting etc. can be done without it

* Test `masternode status` updates

* Don't track mnListEntry anymore and instead get the DMN on demand

* Revert "Add `==` and `!=` operators to CDeterministicMNState"

This reverts commit fba4687581.
2019-10-30 22:31:13 +03:00
MarcoFalke
cf632029b9 Merge #12804: [tests] Fix intermittent rpc_net.py failure.
5a67c0524e [tests] Fix intermittent rpc_net.py failure. (John Newbery)

Pull request description:

  rpc_net.py would intermittently fail on Travis, probably
  due to assuming that two consecutive RPC calls were atomic.
  Fix this by trying the test up to three times and only failing
  if all three attempts fail.

  fixes #11778

Tree-SHA512: f2f5047e05114ad2110377e6221ce057680c240952971fb33863834587d2250896c6b697ba27eef739cd0ab23faf47dfae8cafadc9833cbfab5a6f7e36dae5e2
2019-10-22 15:36:49 +02:00
MarcoFalke
1d8eb903ad Merge #12545: test: Use wait_until to ensure ping goes out
0eb84f30d8 test: Use wait_until to ensure ping goes out (Ben Woosley)

Pull request description:

  Intermittent failure evident here:
  https://travis-ci.org/bitcoin/bitcoin/jobs/344021180

Tree-SHA512: 8d3cbc55563160390d3918eb0b22348990cd81ad35c0563033f19142cb43b86a150fecc7df2196209ba00aaa805c67285451e582f387f8dac22d5e44d54e8a0d
2019-10-22 15:35:42 +02:00
UdjinM6
df3dbe85b7
Wait for sporks to propagate in llmq-chainlocks.py before mining new blocks (#3168)
The bug was introduced in e5ebabeddd
2019-10-22 11:40:17 +03:00
Alexander Block
21d33dd56d
Merge #14413: tests: Allow closed rpc handler in assert_start_raises_init_error (#3157)
62c304ea48 tests: Allow closed http server in assert_start_raises_init_error (Chun Kuan Lee)

Pull request description:

  The rpc handler may be unregistered when http server haven't been closed yet. So it may be allowable to get -342 `non-JSON HTTP response with \'%i %s\' from server` (503 Service Unavailable)

  See https://ci.appveyor.com/project/DrahtBot/bitcoin/build/master.2001. It shows "Rejecting request while shutting down" between "RPC stopped" and "Stopped HTTP server"

Tree-SHA512: e1f50ab9096cf23494ccc2850c01516c4a75f112c99108759157b22fce2011682a4b88216f206702f6a56e960182c00098053ad75f13aa0eafe27046adae63da
2019-10-17 11:59:21 +02:00
Alexander Block
a13a9182d9 Add missing "notfound" and "getsporks" to messagemap (#3146) 2019-10-16 17:10:18 +03:00
Alexander Block
24fee30513
Add support for Gitlab CI (#3149)
* Add .gitlab-ci.yml

* Use | instead of > for multiline commands

This honor new-lines and makes ; unnecessary

* Use ubuntu:bionic as base image

* Move cache initialization before apt-get installs

* Cache apt packages

* Move installation of wget and unzip up as we need it for the cache

* Prevent apt from deleting caches

* Collect test logs into artifact

* Make combine_logs.py always look for the template in the correct dir

* Move final cache stuff into after_script

* Reintroduce PYTHON_DEBUG=1, but only for .travis.yml

* Install jinja2 in Travis builder image

* Enable ChainLocks after quorums have been created

Creating 4 quorums causes a lot of blocks to be created and signed by
ChainLocks, which then causes timeouts later.

* Increase timeout in wallet-dump.py test

The first dumpwallet is quite slow sometimes, which then makes the
later called dumpwallet throw a wallet locked exception.
2019-10-16 11:48:46 +02:00
Wladimir J. van der Laan
fefe07003b Merge #14670: http: Fix HTTP server shutdown
28479f926f21f2a91bec5a06671c60e5b0c55532 qa: Test bitcond shutdown (João Barbosa)
8d3f46ec3938e2ba17654fecacd1d2629f9915fd http: Remove timeout to exit event loop (João Barbosa)
e98a9eede2fb48ff33a020acc888cbcd83e24bbf http: Remove unnecessary event_base_loopexit call (João Barbosa)
6b13580f4e3842c11abd9b8bee7255fb2472b6fe http: Unlisten sockets after all workers quit (João Barbosa)
18e968581697078c36a3c3818f8906cf134ccadd http: Send "Connection: close" header if shutdown is requested (João Barbosa)
02e1e4eff6cda0bfc24b455a7c1583394cbff6eb rpc: Add wait argument to stop (João Barbosa)

Pull request description:

  Fixes #11777. Reverts #11006. Replaces #13501.

  With this change the HTTP server will exit gracefully, meaning that all requests will finish processing and sending the response, even if this means to wait more than 2 seconds (current time allowed to exit the event loop).

  Another small change is that connections are accepted even when the server is stopping, but HTTP requests are rejected. This can be improved later, especially if chunked replies are implemented.

  Briefly, before this PR, this is the order or events when a request arrives (RPC `stop`):
   1. `bufferevent_disable(..., EV_READ)`
   2. `StartShutdown()`
   3. `evhttp_del_accept_socket(...)`
   4. `ThreadHTTP` terminates (event loop exits) because there are no active or pending events thanks to 1. and 3.
   5. client doesn't get the response thanks to 4.

  This can be verified by applying
  ```diff
       // Event loop will exit after current HTTP requests have been handled, so
       // this reply will get back to the client.
       StartShutdown();
  +    MilliSleep(2000);
       return "Bitcoin server stopping";
   }
  ```
  and checking the log output:
  ```
      Received a POST request for / from 127.0.0.1:62443
      ThreadRPCServer method=stop user=__cookie__
      Interrupting HTTP server
  **  Exited http event loop
      Interrupting HTTP RPC server
      Interrupting RPC
      tor: Thread interrupt
      Shutdown: In progress...
      torcontrol thread exit
      Stopping HTTP RPC server
      addcon thread exit
      opencon thread exit
      Unregistering HTTP handler for / (exactmatch 1)
      Unregistering HTTP handler for /wallet/ (exactmatch 0)
      Stopping RPC
      RPC stopped.
      Stopping HTTP server
      Waiting for HTTP worker threads to exit
      msghand thread exit
      net thread exit

      ... sleep 2 seconds ...

      Waiting for HTTP event thread to exit
      Stopped HTTP server
  ```

  For this reason point 3. is moved right after all HTTP workers quit. In that moment HTTP replies are queued in the event loop which keeps spinning util all connections are closed. In order to trigger the server side close with keep alive connections (implicit in HTTP/1.1) the header `Connection: close` is sent if shutdown was requested. This can be tested by
  ```
  bitcoind -regtest
  nc localhost 18443
  POST / HTTP/1.1
  Authorization: Basic ...
  Content-Type: application/json
  Content-Length: 44

  {"jsonrpc": "2.0","method":"stop","id":123}
  ```

  Summing up, this PR:
   - removes explicit event loop exit — event loop exits once there are no active or pending events
   - changes the moment the listening sockets are removed — explained above
   - sends header `Connection: close` on active requests when shutdown was requested which is relevant when it's a persistent connection (default in HTTP 1.1) — libevent is aware of this header and closes the connection gracefully
   - removes event loop explicit break after 2 seconds timeout

Tree-SHA512: 4dac1e86abe388697c1e2dedbf31fb36a394cfafe5e64eadbf6ed01d829542785a8c3b91d1ab680d3f03f912d14fc87176428041141441d25dcb6c98a1e069d8
2019-10-14 13:45:09 +02:00
UdjinM6
dcdf1f3a68
Some refactoring for spork related functionality in tests (#3137)
* Use `wait_until` in sporks.py

* Drop unused spork functions in `dip3-deterministicmns.py`

* Use `wait_until` in multikeysporks.py

* scripted-diff: Rename `*_test_spork_state` to `*_test_spork_value` in multikeysporks.py to better match actual functionality

-BEGIN VERIFY SCRIPT-
sed -i 's/_test_spork_state/_test_spork_value/g' test/functional/multikeysporks.py
-END VERIFY SCRIPT-
2019-10-10 14:52:35 +03:00
UdjinM6
e0c56246f5
Fixes and refactorings related to using mnsync in tests (#3136)
* Drop `get_mnsync_status`, `wait_to_sync` and `sync_masternodes` and introduce `force_finish_mnsync` for MNs only

* Use `force_finish_mnsync` from util.py in dip3-deterministicmns.py and drop local unused functions

Also move the call, `force_finish_mnsync` should be called before `connect_nodes_bi`
2019-10-09 19:48:12 +03:00
Alexander Block
a12b03e5ca Run orphan TX handling tests twice, once by resolving via mempool and once via block 2019-10-07 19:03:50 +02:00
Alexander Block
30767ffc42 Remove unnecessary time imports 2019-10-03 17:05:10 +02:00
Wladimir J. van der Laan
ed65d51262 Merge #13003: qa: Add test for orphan handling
fa02c5b qa: Clarify documentation for send_txs_and_test (MarcoFalke)
fadfbd3 qa: Add test for orphan handling (MarcoFalke)

Pull request description:

Tree-SHA512: e0932d6bd03c73e3113f5457a3ffa3bbfc7b6075dfca8de95224d9df875e60ca6eb15cd8baa226f13de965483006559556191630a83c3bb431e79c53a85ef73f
2019-10-03 17:04:59 +02:00
MarcoFalke
3e72a09c16 Merge #11772: [tests] Change invalidblockrequest to use BitcoinTestFramework
e97b113b04 [tests] Change invalidblockrequest to use BitcoinTestFramework (John Newbery)
2b7064eda7 [tests] Fix flake8 warnings in invalidblockrequest (John Newbery)
54b8c580b7 [test] Fix nits leftover from 11771 (Conor Scott)

Pull request description:

  Builds on #11771. Please review that PR first

  Next step in #10603.

  - first commit tidies up invalidblockrequest.py
  - second commit removes usage of ComparisonTestFramework

Tree-SHA512: 14b10c09c8c0ebef4a9176eb5b883a275d04c096785ee31b84ef594eed346ec6344d7ed32184c5fb397e744725df3911f45cdfadd0810e5a52eaa256084e3456
2019-10-03 14:04:54 +02:00
Alexander Block
573d1da16f Use NodeConnCB as base for P2PDataStore
Until the renaming to P2PInterface is backported.
2019-10-03 14:04:54 +02:00
Wladimir J. van der Laan
01c138e86b Merge #11771: [tests] Change invalidtxrequest to use BitcoinTestFramework
95e2e9a [tests] Change invalidtxrequest to use BitcoinTestFramework (John Newbery)
359d067 [tests] Fix flake8 warnings in invalidtxrequest (John Newbery)
c32cf9f [tests] Add P2PDataStore class (John Newbery)
cc046f6 [tests] Reduce NodeConn connection logging from info to debug (John Newbery)

Pull request description:

  Next step in #10603

  - first commit changes log level for an internal log from INFO to DEBUG. (Not really related, but I started finding the INFO level logging annoying when debuging test failures)
  - second commit introduces a `P2PStub` class - a subclass of `NodeConnCB` which has its own block and tx store and responds appropriately to getdata requests. Not all the functionality is used in `invalidtxrequest.py`, but will be used in `invalidblockrequest.py` and `p2p-fullblocktest` when those are changed to use `BitcoinTestFramework`
  - third commit tidies up `invalidtxrequest.py`
  - fourth commit removes usage of `ComparisonTestFramework`

Tree-SHA512: f3085c73c15d6ce894e401490bce8a7fa7cf52b0c9d135ff7e351f1f6f517c99accab8588fcdc443f39ea8315329aaabd66b2baa32499df5a774737882030373
2019-10-03 14:04:54 +02:00
Wladimir J. van der Laan
f4ea836744 Merge #11849: [tests] Assert that only one NetworkThread exists
5c8ff26 [tests] Add NetworkThread assertions (John Newbery)
34e08b3 [tests] Fix network threading in functional tests (John Newbery)
74e64f2 [tests] Use network_thread_start() in tests. (John Newbery)
5fc6e71 [tests] Add network_thread_ utility functions. (John Newbery)

Pull request description:

  Add assert that only one NetworkThread exists at any time in functional tests, and fix cases where that wasn't true.

  fixes #11776

Tree-SHA512: fe5d1c59005f94bf66e11bb23ccf274b1cd9913741b56ea11dbcd21db4cc0b53b4413c0c4c16dbcd6ac611adad5e5cc2baaa39720598ce7b6393889945d06298
2019-10-03 14:04:54 +02:00
Wladimir J. van der Laan
6e6e950fca Merge #11641: qa: Only allow disconnecting all NodeConns
faaa7db qa: Only allow disconnecting all NodeConns (MarcoFalke)

Pull request description:

  Disconnecting the connection with `index=0` makes no sense when there are more than one connections, as the list "rotates around" and populates index 0 after `del`.

  Just disconnect all NodeConns in any case.

Tree-SHA512: e5cf540823fccb31634b5a11501f54222be89862e80ccafc28bc06726480f8d2153b8c1b6f859fa6a6d087876251d48a6c6035bccdaaf16831e300bc17ff613d
2019-10-03 14:04:54 +02:00
MarcoFalke
7c163b1ffd Merge #11182: [tests] Add P2P interface to TestNode
32ae82f5c [tests] use TestNode p2p connection in tests (John Newbery)
5e5725cc2 [tests] Add p2p connection to TestNode (John Newbery)
b86c1cd20 [tests] fix TestNode.__getattr__() method (John Newbery)

Pull request description:

  Final two steps of #10082 : Adding the "mininode" P2P interface to `TestNode`

  This PR adds the mininode P2P interface to `TestNode`. It simplifies the process for opening a P2P connection to the node-under-test from this:

  ```python
  node0 = NodeConnCB()
  connections = []
  connections.append(NodeConn('127.0.0.1', p2p_port(0), self.nodes[0], node0))
  node0.add_connection(connections[0])
  ```

  to this:

  ```python
  self.nodes[0].add_p2p_connection(p2p_conn_type=NodeConnCB)
  ```

  The first commit adds the infrastructure to `test_node.py`. The second updates the individual test cases to use it. Can be separated if this is too much review for one PR.

Tree-SHA512: 44f1a6320f44eefc70489ae8350c6a16ad1a6035e4b9b7bafbdf19f5905ed0e2db85beaaf4758eec3059dd89a375a47a45352a029f39f57a86ab38a9ae66650e
2019-10-03 14:04:54 +02:00
Alexander Block
d49ee618f9 Add more logging to DashTestFramework (#3130) 2019-10-03 13:45:18 +03:00
Alexander Block
cd6c5b4b4e
Multiple fixes for ChainLock tests (#3129)
* Add timeout params to wait_for*_chainlock methods

* Give chainlocks more time in specific case

* Add logs to llmq-chainlock.py

* Replace wait_for_chainlocked_tip_all_nodes with wait_for_chainlocked_block_all_nodes

wait_for_chainlocked_tip_all_nodes did wait for the tip of each individual
node, which would not necessarily be the same. We should only allow to
explicitly specify which block to wait for.

* Get rid of wait_for_chainlocked_tip

Same as with wait_for_chainlocked_tip_all_nodes
2019-10-02 15:24:57 +02:00
Alexander Block
e06c116d20 Actually pass extra_args to nodes in assumevalid.py (#3131)
This speeds up assumevalid.py from 22s to 7s on my machine. On travis, this
should be an improvement of a few minutes. Without this, Travis actually
fails due to block download timeouts.
2019-10-02 03:12:16 +03:00
UdjinM6
737ac967f5
Refactor some Dash-specific wait_for* functions in tests (#3122)
* scripted-diff: Rename `wait_for_chainlock*` test functions

-BEGIN VERIFY SCRIPT-
sed -i 's/wait_for_chainlock_tip_all_nodes(/wait_for_chainlocked_tip_all_nodes(/g' test/functional/*.py
sed -i 's/wait_for_chainlock_tip(/wait_for_chainlocked_tip(/g' test/functional/*.py
sed -i 's/wait_for_chainlock(/wait_for_chainlocked_block(/g' test/functional/*.py
sed -i 's/wait_for_chainlock /wait_for_chainlocked_block /g' test/functional/*.py
-END VERIFY SCRIPT-

* Move `wait_for_*chainlock*` functions from individual tests to DashTestFramework

* Use `wait_until` in most Dash-specific `wait_for*` functions instead of custom timers
2019-10-02 03:11:10 +03:00
UdjinM6
bad3243b8e
Bump mocktime before generating new blocks and generate a few blocks at the end of test_mempool_doublespend in p2p-instantsend.py (#3125)
* Cleanup p2p-instantsend.py

Bump mocktime before generating new blocks and generate a few blocks at the end of test_mempool_doublespend to clean things up

* Update test/functional/p2p-instantsend.py

Co-Authored-By: PastaPastaPasta <6443210+PastaPastaPasta@users.noreply.github.com>
2019-10-01 17:15:28 +03:00