aboutsummaryrefslogtreecommitdiff
path: root/test/functional
AgeCommit message (Collapse)Author
2017-11-29[tests] Add combinedlogslen argument to test_runner.pyJohn Newbery
Instead of calling combine_logs from test_runner when the environment variable PYTHON_DEBUG is set, add a combinedlogslen argument. This makes it easier to call when running locally, and allows a different length of combined logs to be printed.
2017-11-29[tests] [travis-ci] Move Travis functional test log post processing to ↵John Newbery
test_runner
2017-11-29[tests] Improve logging shutdown and add hint for combine_logsJohn Newbery
2017-11-25Merge #11683: tests: Remove unused mininode functions ↵MarcoFalke
{ser,deser}_int_vector(...). Remove unused imports. f522fb7c9 tests: Remove unused mininode functions deser_int_vector(f) and ser_int_vector(l) (practicalswift) 0f3b752ec Remove unused imports (practicalswift) Pull request description: * Remove unused mininode functions `deser_int_vector(f)` and `ser_int_vector(l)`. Last use removed in 3858aabbd084b2cc4534c40a178bbcc22fb82968. Friendly ping @jnewbery :-) * Remove unused imports. Tree-SHA512: 840c5623eae9f929561f6e86816883c5904ec1af82fc8d5e56dee1c0b1fe22e8600c10f7358ed8b556b3aec8c65c4910f6eee30e8015a573c4df8bef91124d3e
2017-11-22Merge #11743: qa: Add multiwallet prefix testMarcoFalke
fa61c6f6a qa: Add multiwallet prefix test (MarcoFalke) Pull request description: Fixes https://github.com/bitcoin/bitcoin/pull/10849#discussion_r127847938 Tree-SHA512: 7967be04e76d935398b3bea60c864ffc9e38dbb4cfb55890bb146a6f16c28d81ca5d89736275e2d0b03642806f6f7093beeea979f5257c464f437c4e5a9684f1
2017-11-18Merge #11707: [tests] Fix sendheadersMarcoFalke
9d42cc333 [tests] address review comments (John Newbery) f0c4ab9a7 [tests] fix flakiness in sendheaders.py (John Newbery) 25fd6e2c2 [tests] refactor check_last_announcement() in sendheaders.py (John Newbery) f39d4bbd1 [tests] tidy up BaseNode in sendheaders.py (John Newbery) 2613c545f [tests] fix flake8 warnings in sendheaders.py (John Newbery) Pull request description: This PR should fix the intermittent failure of sendheaders.py described in #11673. The first three commits are tidying up and refactoring the file. The final commit _fix flakiness in sendheaders.py_ fixes the intermittent failures. The commit message for that commit describes the problems that are being fixed. I think @laanwj @MeshCollider @MarcoFalke have seen these failures. fixes #11673 Tree-SHA512: 278e1af85f2eae00f970f2d8ef33686dd52b4f62180dea4cfdaff7bcf3287c6f1c2930355d99461a12f0c51c4d42cc3b1cb3275174134028ca4d06ffc24c18dd
2017-11-18Merge #11466: Specify custom wallet directory with -walletdir paramWladimir J. van der Laan
c1e5d40 Make debugging test crash easier (MeshCollider) 8263f6a Create walletdir if datadir doesn't exist and fix tests (MeshCollider) 9587a9c Default walletdir is wallets/ if it exists (MeshCollider) d987889 Add release notes for -walletdir and wallets/ dir (MeshCollider) 80c5cbc Add test for -walletdir (MeshCollider) 0530ba0 Add -walletdir parameter to specify custom wallet dir (MeshCollider) Pull request description: Closes #11348 Adds a `-walletdir` parameter which specifies a directory to use for wallets, allowing them to be stored separately from the 'main' data directory. Creates a new `wallets/` directory in datadir if this is the first time running, and defaults to using it if it exists. Includes tests and release notes. Things which might need to be considered more: - there is no 'lock' on the wallets directory, which might be needed? - because this uses a new wallets/ directory by default, downgrading to an earlier version won't see the wallets in that directory (not a big deal though, users can just copy them up to the main dir) - jnewbery suggested putting each wallet in its own directory, which is a good idea, but out of scope for this PR IMO. EDIT: this is being done in https://github.com/bitcoin/bitcoin/pull/11687 - doc/files.md needs updating (will do soon) I also considered including a cleanup by removing caching of data directory paths and instead just initialise them once on startup (c.f. #3073), but decided it wasn't super relevant here will just complicate review. Tree-SHA512: c8ac04bfe9a810c32055f2c8b8fa0d535e56125ceb8d96f12447dd3538bf3e5ee992b60b1cd2173bf5f3fa023a9feab12c9963593bf27ed419df929bb413398d
2017-11-17[tests] address review commentsJohn Newbery
2017-11-17tests: Remove unused mininode functions deser_int_vector(f) and ↵practicalswift
ser_int_vector(l)
2017-11-17Remove unused importspracticalswift
2017-11-17cli: Reject arguments to -getinfoWladimir J. van der Laan
Currently it's possible to accidentally type e.g. bitcoin-cli -getinfo getbalance and get an answer which can be confusing; the trialing arguments are just ignored. To avoid this, throw an error if the user provides arguments to `-getinfo`.
2017-11-17Merge #11648: [tests] Add messages.pyWladimir J. van der Laan
1135c79 [tests] Tidy up mininode.py module (John Newbery) f9cd9b1 [tests] Move test_framework Bitcoin primitives into separate module (John Newbery) Pull request description: Second part of #11518. Moves the primitive Bitcoin datastructures and message classes into their own module, and tidies up the mininode.py module. - First commit is almost entirely move-only - Second commit is mostly move-only, but also does a little tidying. Tree-SHA512: 5d74802677f1ab788e43188653106a96fffd9ab1fe3aa6a4eb94e5807de5dd5c8ee212296f45e8d16c7e3d95cfc4891677e812b7944bd3ab604e04b3b88aa06e
2017-11-18Make debugging test crash easierMeshCollider
2017-11-18Create walletdir if datadir doesn't exist and fix testsMeshCollider
2017-11-18Add test for -walletdirMeshCollider
2017-11-16[tests] fix flakiness in sendheaders.pyJohn Newbery
Fixes to sources of intermittent failure in sendheaders.py - at the start of test_null_locators(), a new block is generated and then a getheaders is sent. check_last_accouncement() is called to assert that the headers message is received. However, the new block triggers an inv to be sent over both P2P connections, so there's a race. If the inv is received at the wrong time, the test fails. - test_null_locators() ends by sending a block to the node under test. At the start of test_nonnull_locators(), a block is mined and check_last_announcement() is called to assert that the inv received is for the same block. That means there's a race: if the inv from the block sent in test_null_locators() is received at the wrong time, the test fails.
2017-11-16[tests] refactor check_last_announcement() in sendheaders.pyJohn Newbery
All calls of check_last_announcement() asserted that the return value was True. Just assert inside the function instead. This gives better debug information if the assert fails. Also only check the contents of the most recent inv and header if check_last_announcement() is called with the relevant argument.
2017-11-16[tests] tidy up BaseNode in sendheaders.pyJohn Newbery
2017-11-16[tests] fix flake8 warnings in sendheaders.pyJohn Newbery
2017-11-16Merge #11087: Diagnose unsuitable outputs in lockunspent().Wladimir J. van der Laan
28f8b66 Diagnose unsuitable outputs in lockunspent(). (Eelis) Pull request description: Fixes #2667. This is a simplified version of pull request #3574, which was abandoned by its author. I added some tests as well. Tree-SHA512: e63e00dec8b1b232079380183805cb0b0b18c78ea6bea769837949aab984689d7f68b2ccfe66b1873517b040b9e616ce0eb058575c3d4382aa8c26eebcf1f14e
2017-11-15qa: Add multiwallet prefix testMarcoFalke
2017-11-14Merge #11677: qa: Remove unused NodeConn membersMarcoFalke
fafdad0d4 qa: Remove unused NodeConn members (MarcoFalke) Pull request description: * `ver_send` and `ver_recv` were completely unused * `rpc` was only used once, in p2p-segwit. Imo better only pass it to the constructor in that single test Tree-SHA512: 7f85554d6d0fd2096516ca3c608811d5370da66cde35d8031bdc921607a7a4efdb26355896012f75f713f8df09e28d46ba46be69fd96a5898fabb1a25cbcb8ad
2017-11-14Merge #11641: qa: Only allow disconnecting all NodeConnsWladimir J. van der Laan
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
2017-11-13qa: Remove unused NodeConn membersMarcoFalke
2017-11-13qa: Only allow disconnecting all NodeConnsMarcoFalke
2017-11-11Merge #11055: [wallet] [rpc] getreceivedbyaddress should return error if ↵MarcoFalke
called with address not owned by the wallet 5e0ba8f8c [wallet] getreceivedbyaddress should return error if address is not mine (John Newbery) ea0cd24f7 [tests] Tidy up receivedby.py (John Newbery) Pull request description: Two commits: - First commit tidies up the `receivedby.py` test (and speeds it up by factor of two) - Second commit changes getreceivedbyaddress to return error if the address is not found in wallet, and adds test to `receivedby.py` Tree-SHA512: e41342dcbd037a6b440cbe4ecd3b8ed589e18e477333f0d866f3564e948e0f5231e497d5ffb66da4e6680eb772d9f0cf839125098bb68b92d04a5ee35c6c0a81
2017-11-10Merge #11258: [rpc] Add initialblockdownload to getblockchaininfoPieter Wuille
11413646b [trivial] (whitespace only) fix getblockchaininfo alignment (John Newbery) bd9c18171 [rpc] Add initialblockdownload to getblockchaininfo (John Newbery) Pull request description: Exposing whether the node is in IBD would help for testing, and may be useful in general, particularly for developers. First discussed in #10357 here: https://github.com/bitcoin/bitcoin/pull/10357#pullrequestreview-59963870 > ... we could simplify this (and possibly other) tests by just adding a way to know if a node is in IBD. I'd like to do that, but I'm not sure it makes sense to complicate this PR with discussion over how that information should be made available. Eg it's not clear to me that the notion of being in IBD is worth exposing to the casual user, versus a hidden rpc call or something, since the definition has changed over time, and may continue to change in the future. But I still do agree that at least for testing purposes it would be far simpler to expose the field somehow... This PR currently implements the simplest way of doing this: adding an `initialblockdownload` field to `getblockchaininfo`. Other approaches we could take: 1. add a new debug RPC method that exposes `IBD` and potentially other information. 2. add a parameter to `getblockchaininfo`, eg `debug_info`, which would cause it to return debug information including IBD 3. add a query string to the url `?debug=true` which would cause RPCs to return additional debug information. I quite like the idea of (3). Feedback on these and other approaches very much welcomed! @sdaftuar @laanwj Tree-SHA512: a6dedd47f8c9bd38769cc597524466250041136feb33500644b9c48d0ffe4e3eeeb2587b5bbc6420364ebdd2667df807fbb50416f9a7913bbf11a14ea86dc0d4
2017-11-10[wallet] getreceivedbyaddress should return error if address is not mineJohn Newbery
2017-11-10[tests] Tidy up receivedby.pyJohn Newbery
- Fix flake8 warnings - Remove the useless get_sub_array_from_array() function - Reduce runtime for receivedby.py by about half by only using two nodes
2017-11-10[tests] Tidy up mininode.py moduleJohn Newbery
Mostly move only. Adds a few extra comments.
2017-11-10[tests] Move test_framework Bitcoin primitives into separate moduleJohn Newbery
mininode.py wildcard imports all names from primitives.py. This is to avoid having to change all test scripts that import from mininode.py.
2017-11-10Merge #11468: [tests] Make comp test framework more debuggableMarcoFalke
748157913 [tests] Make comp test framework more debuggable (John Newbery) Pull request description: We should remove the comparison test framework entirely (see #10603). Until we do that, let's make it a bit more debuggable. Currently, if there's an assert in the framework, it's very difficult to track down where we are in the test generator. Make the logging a bit better to help with debugging. Before this PR: ``` → ./p2p-fullblocktest.py 2017-10-09 14:05:11.302000 TestFramework (INFO): Initializing test directory /tmp/user/1000/testzdnax_yr 2017-10-09 14:05:11.557000 TestFramework.mininode (INFO): Connecting to Bitcoin Node: 127.0.0.1:11975 2017-10-09 14:05:11.712000 TestFramework.comptool (INFO): Test 1: PASS 2017-10-09 14:05:11.947000 TestFramework.comptool (INFO): Test 2: PASS 2017-10-09 14:05:12.057000 TestFramework.comptool (INFO): Test 3: PASS 2017-10-09 14:05:12.058000 TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "/home/ubuntu/bitcoin/test/functional/test_framework/test_framework.py", line 117, in main self.run_test() File "./p2p-fullblocktest.py", line 72, in run_test self.test.run() File "/home/ubuntu/bitcoin/test/functional/test_framework/comptool.py", line 306, in run assert test_number != 4 AssertionError 2017-10-09 14:05:12.059000 TestFramework (INFO): Stopping nodes 2017-10-09 14:05:14.203000 TestFramework (WARNING): Not cleaning up dir /tmp/user/1000/testzdnax_yr 2017-10-09 14:05:14.204000 TestFramework (ERROR): Test failed. Test logging available at /tmp/user/1000/testzdnax_yr/test_framework.log ``` With this PR: ``` → ./p2p-fullblocktest.py 2017-10-09 14:03:54.069000 TestFramework (INFO): Initializing test directory /tmp/user/1000/testuey7t3tf 2017-10-09 14:03:54.329000 TestFramework.mininode (INFO): Connecting to Bitcoin Node: 127.0.0.1:11783 2017-10-09 14:03:54.383000 TestFramework.comptool (INFO): Running test 1: ./p2p-fullblocktest.py line 184 2017-10-09 14:03:54.496000 TestFramework.comptool (INFO): Running test 2: ./p2p-fullblocktest.py line 193 2017-10-09 14:03:54.758000 TestFramework.comptool (INFO): Running test 3: ./p2p-fullblocktest.py line 205 2017-10-09 14:03:54.867000 TestFramework.comptool (INFO): Running test 4: ./p2p-fullblocktest.py line 208 2017-10-09 14:03:54.867000 TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "/home/ubuntu/bitcoin/test/functional/test_framework/test_framework.py", line 117, in main self.run_test() File "./p2p-fullblocktest.py", line 72, in run_test self.test.run() File "/home/ubuntu/bitcoin/test/functional/test_framework/comptool.py", line 309, in run assert test_number != 4 AssertionError 2017-10-09 14:03:54.868000 TestFramework (INFO): Stopping nodes 2017-10-09 14:03:56.950000 TestFramework (WARNING): Not cleaning up dir /tmp/user/1000/testuey7t3tf 2017-10-09 14:03:56.950000 TestFramework (ERROR): Test failed. Test logging available at /tmp/user/1000/testuey7t3tf/test_framework.log ``` Tree-SHA512: 5525958b0098d661c281bd955c92c72bf81359464376e96d44e6c88f18aea57ba08270ecd564edda4b47d674e3b27d20e5b1060544bf8dd5c6a68103d2bb35b8
2017-11-09Merge #11580: Do not send (potentially) invalid headers in response to ↵Wladimir J. van der Laan
getheaders 725b79a [test] Verify node doesn't send headers that haven't been fully validated (Russell Yanofsky) 3788a84 Do not send (potentially) invalid headers in response to getheaders (Matt Corallo) Pull request description: Nowhere else in the protocol do we send headers which are for blocks we have not fully validated except in response to getheaders messages with a null locator. On my public node I have not seen any such request (whether for an invalid block or not) in at least two years of debug.log output, indicating that this should have minimal impact. Tree-SHA512: c1f6e0cdcdfb78ea577d555f9b3ceb1b4b60eff4f6cf313bfd8b576c9562d797bea73abc23f7011f249ae36dd539c715f3d20487ac03ace60e84e1b77c0c1e1a
2017-11-09Merge #11638: [tests] Dead mininode codeMarcoFalke
fb00c45c3 [tests] Explicitly disallow support for p2p versions below 60001 (John Newbery) 3858aabbd [tests] Remove support for p2p alert messages (John Newbery) c0b127470 [tests] Remove support for bre-BIP31 ping messages (John Newbery) 2904e301c [tests] Remove dead code from mininode.py (John Newbery) Pull request description: This is the first part of #11518. It removes a ~150 lines of unused code from the mininode module: - remove unused `deliver_sleep_time` and `EarlyDisconnectError` code - remove support for pre-BIP31 ping messages - remove support for alert message - explicitly don't support p2p versions lower than 60001 Should be an easy ACK for reviewers. If all extended tests pass, then this code really was dead :) Tree-SHA512: 508e612ceb0b094250d18e75522d51e6b14cd069443050ba4af34d6f890c58721cb5653e8bc000b60635b9474d035b0dcd9c509c0dcdb3a7501df17b787f83b0
2017-11-09Merge #11552: Improve wallet-accounts testWladimir J. van der Laan
bc9c0a7 Improve wallet-accounts test (Russell Yanofsky) Pull request description: Add comments and - Verify sending to a account causes getaccountaddress to generate new addresses. - Verify sending to a account causes getreceivedbyaccount to return amount received. - Verify ways setaccount updates the accounts of existing addresses. Tree-SHA512: 4facc8d10fb23847081e8081839d4050faa855cca40f34012b82297bf1a8cfdb975b26314bc518dc6b3f5997452a7acf309f9627e0dff359347c628b37014bfa
2017-11-08[tests] Explicitly disallow support for p2p versions below 60001John Newbery
The mininode module includes code to support p2p versions below 60001. However, the test_framework does not support versions of Bitcoin Core before V0.13.0. Remove code supporting p2p versions before 60001 (which has never been run).
2017-11-08[tests] Remove support for p2p alert messagesJohn Newbery
Alert messages were removed in p2p version 70013 (Bitcoin Core V0.13.0)
2017-11-08[tests] Remove support for bre-BIP31 ping messagesJohn Newbery
BIP31 support was added to Bitcoin Core in version 0.6.1. Our test framework is incompatible with Bitcoin Core versions that old, so remove all special logic for handling pre-BIP31 pings.
2017-11-08[tests] Remove dead code from mininode.pyJohn Newbery
Removes the dead deliver_sleep_time and EarlyDisconnectError code
2017-11-08[tests] use TestNode p2p connection in testsJohn Newbery
2017-11-08[tests] Add p2p connection to TestNodeJohn Newbery
p2p connections can now be added to TestNode instances. This commit also updates the example test to use the new p2p interface in TestNode to demonstrate usage. A future commit will update the existing tests to use p2p through the TestNode.
2017-11-08[tests] fix TestNode.__getattr__() methodJohn Newbery
2017-11-07Merge #11389: Support having SegWit always active in regtest (sipa, ajtowns, ↵MarcoFalke
jnewbery) d61845818 Have SegWit active by default (Pieter Wuille) 4bd89210a Unit tests for always-active versionbits. (Anthony Towns) d07ee77ab Always-active versionbits support (Pieter Wuille) 18e071841 [consensus] Pin P2SH activation to block 173805 on mainnet (John Newbery) 526023aa7 Improve handling of BIP9Deployment limits (Anthony Towns) Pull request description: Most tests shouldn't have to deal with the now-historical SegWit activation transition (and other deployments, but SegWit is certainly the hardest one to accomodate). This PR makes a versionbits starttime of -1 equal to "always active", and enables it by default for SegWit on regtest. Individual tests can override this by using the existing `-vbparams` option. A few unit tests and functional tests are adapted to indeed override vbparams, as they specifically test the transition. This is in preparation for wallet SegWit support, but I thought having earlier eyes on it would be useful. Tree-SHA512: 3f07a7b41cf46476e6c7a5c43244e68c9f41d223482cedaa4c02a3a7b7cd0e90cbd06b84a1f3704620559636a2268f5767d4c52d09c1b354945737046f618fe5
2017-11-06Have SegWit active by defaultPieter Wuille
2017-11-02[test] Verify node doesn't send headers that haven't been fully validatedRussell Yanofsky
2017-11-01Merge #11376: Ensure backupwallet fails when attempting to backup to source fileMarcoFalke
5d465e396 Ensure backupwallet fails when attempting to backup to source file (Tomas van der Wansem) Pull request description: Previous behaviour was to destroy the wallet (to zero-length) This fixes #11375 Tree-SHA512: bfd1738659b15e3f23b6bbdf55ec12269c62c820bf701daec19500b52bd5845bb5516733c6f76f36197eb155182a8a35dc239ad4de2ef1e59bbb0f124a455759
2017-11-01Merge #11531: Check that new headers are not a descendant of an invalid ↵Wladimir J. van der Laan
block (more effeciently) f3d4adf Make p2p-acceptablock not an extended test (Matt Corallo) 00dcda6 [qa] test that invalid blocks on an invalid chain get a disconnect (Matt Corallo) 015a525 Reject headers building on invalid chains by tracking invalidity (Matt Corallo) 932f118 Accept unrequested blocks with work equal to our tip (Matt Corallo) 3d9c70c Stop always storing blocks from whitelisted peers (Matt Corallo) 3b4ac43 Rewrite p2p-acceptblock in preparation for slight behavior changes (Matt Corallo) Pull request description: @sdaftuar pointed out that the version in #11487 was somewhat DoS-able as someone could feed you a valid chain that forked off the the last checkpoint block and force you to do lots of work just walking backwards across blocks for each new block they gave you. We came up with a few proposals but settled on the one implemented here as likely the simplest without obvious DoS issues. It uses our existing on-load mapBlockIndex walk to make sure everything that descends from an invalid block is marked as such, and then simply caches blocks which we attempted to connect but which were found to be invalid. To avoid DoS issues during IBD, this will need to depend on #11458. Includes tests from #11487. Tree-SHA512: 46aff8332908e122dae72ceb5fe8cd241902c2281a87f58a5fb486bf69d46458d84a096fdcb5f3e8e07fbcf7466232b10c429f4d67855425f11b38ac0bf612e1
2017-11-01Merge #11565: Make listsinceblock refuse unknown block hashWladimir J. van der Laan
659b206 Make listsinceblock refuse unknown block hash (Russell Yanofsky) Pull request description: Change suggested by @theuni who noticed listsinceblock would ignore invalid block hashes causing it to return a completely unfiltered list of transactions. Tree-SHA512: 3c8fb160265780d1334e856e853ab48e2e18372b8f1fc71ae480c3f45317048cc1fee0055d5c58031981a91b9c2bdbeb8e49a889d04ecba61729ce8109f2ce3f
2017-10-31Make p2p-acceptablock not an extended testMatt Corallo
2017-10-31[qa] test that invalid blocks on an invalid chain get a disconnectMatt Corallo