Commit Graph

790 Commits

Author SHA1 Message Date
MarcoFalke a13a417cdc
Merge #9823: qa: Set correct path for binaries in rpc tests
3333ad0 qa: Set correct path for binaries in rpc tests (MarcoFalke)
2017-02-23 17:36:02 +01:00
MarcoFalke d6064a89ac
Merge #9577: Fix docstrings in qa tests
3f95a80 Fix docstrings in qa tests (John Newbery)
2017-02-23 16:39:22 +01:00
MarcoFalke 7146d96de3
Merge #9766: Add --exclude option to rpc-tests.py
c578408 Add exclude option to rpc-tests.py (John Newbery)
2017-02-23 16:34:07 +01:00
John Newbery 3f95a806b1 Fix docstrings in qa tests
This commit fixes the module-level docstrings for the tests and helper
modules in qa. Many of these tests were uncommented previously - this
commit ensures that every test case has at least a minimum level of
commenting.
2017-02-23 10:31:04 -05:00
Wladimir J. van der Laan 1d2a57e9fd
Merge #9824: qa: Check return code when stopping nodes
fa4cd2e qa: Check return code when stopping nodes (MarcoFalke)
2017-02-23 10:40:47 +01:00
Wladimir J. van der Laan d14555de3d
Merge #9820: Fix pruning test broken by 2 hour manual prune window
874c736 Fix pruning test broken by 2 hour manual prune window (Russell Yanofsky)
2017-02-23 10:38:26 +01:00
MarcoFalke fa4cd2e998 qa: Check return code when stopping nodes
This includes work by jnewbery
2017-02-23 03:05:43 +01:00
MarcoFalke 3333ad0b63 qa: Set correct path for binaries in rpc tests 2017-02-22 10:49:02 +01:00
MarcoFalke 5628c70f2a
Merge #9807: RPC doc fix-ups.
851f6a3 [qa][doc] Correct rpc test options in readme (fanquake)
41e7219 [trivial] Add tests_config.ini to .gitignore (fanquake)
2017-02-22 00:05:22 +01:00
Russell Yanofsky 874c7363d7 Fix pruning test broken by 2 hour manual prune window
Regression happened in 91fb506 Add two hour buffer to manual pruning.
2017-02-21 12:57:30 -05:00
John Newbery c5784085e9 Add exclude option to rpc-tests.py 2017-02-20 18:19:05 -05:00
Wladimir J. van der Laan aa791e2911
Merge #9619: Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates
279f944 QA: Test GBT size/weight limit values (Luke Dashjr)
9fc7f0b Bugfix: RPC/Mining: GBT should return 1 MB sizelimit before segwit activates (Luke Dashjr)
2017-02-20 17:32:02 +01:00
fanquake 851f6a39f1
[qa][doc] Correct rpc test options in readme 2017-02-20 09:45:32 +08:00
MarcoFalke 7ff4a538a8
Merge #9657: Improve rpc-tests.py
a6a3e58 Various review markups for rpc-tests.py improvements (John Newbery)
3de3ccd Refactor rpc-tests.py (John Newbery)
afd38e7 Improve rpc-tests.py arguments (John Newbery)
91bffff Use argparse in rpc_tests.py (John Newbery)
1581ecb Use configparser in rpc-tests.py (John Newbery)
2017-02-18 15:29:40 +01:00
MarcoFalke 8efd1c820b
Merge #9744: Remove unused module from rpc-tests
a432aa0 Remove unused module from rpc-tests (Takashi Mitsuta)
2017-02-18 11:31:32 +01:00
John Newbery a6a3e58c48 Various review markups for rpc-tests.py improvements 2017-02-17 14:22:56 -05:00
Luke Dashjr 279f944e8d QA: Test GBT size/weight limit values 2017-02-16 18:47:55 +00:00
Russell Yanofsky e662af3583 Use 2 hour grace period for key timestamps in importmulti rescans
Gregory Maxwell <greg@xiph.org> pointed out the lack of grace period in
https://github.com/bitcoin/bitcoin/pull/9490#issue-199407998.

The importwallet RPC which uses key timestamps in a similar way already has a 2
hour grace period.
2017-02-16 09:05:55 -05:00
Russell Yanofsky 38d3e9ee59 [qa] Extend import-rescan.py to test imports on pruned nodes. 2017-02-16 09:05:55 -05:00
Russell Yanofsky c28583d062 [qa] Extend import-rescan.py to test specific key timestamps 2017-02-16 09:05:55 -05:00
Russell Yanofsky 8be0866883 [qa] Simplify import-rescan.py
Get rid of partial functions so the test can be more easily extended to add
more variants of imports with options that affect rescanning (e.g. different
key timestamps).

Also change the second half of the test to send /to/ the imported addresses,
instead of /from/ the imported addresses. The goal of this part of the test was
to confirm that the wallet would pick up new transactions after an import
regardless of whether or not a rescan happened during the import. But because
the wallet can only do this reliably for incoming transactions and not outgoing
transactions (which require the wallet to look up transaction inputs) the test
previously was less meaningful than it should have been.
2017-02-16 09:05:55 -05:00
Wladimir J. van der Laan 1e92e041dd
Merge #9765: Harden against mistakes handling invalid blocks
ba803ef Harden against mistakes handling invalid blocks (Suhas Daftuar)
2017-02-16 10:23:41 +01:00
Wladimir J. van der Laan 7a93af8340
Merge #9756: Return error when importmulti called with invalid address.
9acf25c Return error when importmulti called with invalid address. (Russell Yanofsky)
2017-02-15 16:29:16 +01:00
Suhas Daftuar ba803efb68 Harden against mistakes handling invalid blocks
Fixes a bug in AcceptBlock() in invoking CheckBlock() with incorrect
arguments, and restores a call to CheckBlock() from ProcessNewBlock()
as belt-and-suspenders.

Updates the (overspecified) tests to match behavior.
2017-02-15 08:17:57 -05:00
Wladimir J. van der Laan d8e8b06bd0
Merge #9108: Use importmulti timestamp when importing watch only keys (on top of #9682)
a80f98b Use importmulti timestamp when importing watch only keys (Russell Yanofsky)
a58370e Dedup nTimeFirstKey update logic (Russell Yanofsky)
2017-02-15 11:13:48 +01:00
Wladimir J. van der Laan e87ce95fbd
Merge #9720: net: fix banning and disallow sending messages before receiving verack
d943491 qa: add a test to detect leaky p2p messages (Cory Fields)
8650bbb qa: Expose on-connection to mininode listeners (Matt Corallo)
5b5e4f8 qa: mininode learns when a socket connects, not its first action (Matt Corallo)
cbfc5a6 net: require a verack before responding to anything else (Cory Fields)
8502e7a net: parse reject earlier (Cory Fields)
c45b9fb net: correctly ban before the handshake is complete (Cory Fields)
2017-02-14 14:42:29 +01:00
Wladimir J. van der Laan b08656e343
Merge #9715: Disconnect peers which we do not receive VERACKs from within 60 sec
66f861a Add a test for P2P inactivity timeouts (Matt Corallo)
b436f92 qa: Expose on-connection to mininode listeners (Matt Corallo)
8aaba7a qa: mininode learns when a socket connects, not its first action (Matt Corallo)
2cbd119 Disconnect peers which we do not receive VERACKs from within 60 sec (Matt Corallo)
2017-02-14 14:35:15 +01:00
Wladimir J. van der Laan edc9e63c57
Merge #9682: Require timestamps for importmulti keys
266a811 Use MTP for importmulti "now" timestamps (Russell Yanofsky)
3cf9917 Add test to check new importmulti "now" value (Russell Yanofsky)
442887f Require timestamps for importmulti keys (Russell Yanofsky)
2017-02-14 14:32:22 +01:00
Cory Fields d9434918d2 qa: add a test to detect leaky p2p messages
This is certainly not exhaustive, but it's better than nothing. Adds checks
for:

- Any message received before sending a version
- Any message received other than version/reject before sending a verack

It also tries to goad the remote into sending a pong, address, or block
announcement.
2017-02-13 18:56:03 -05:00
Matt Corallo 8650bbb660 qa: Expose on-connection to mininode listeners 2017-02-13 18:56:03 -05:00
Matt Corallo 5b5e4f8330 qa: mininode learns when a socket connects, not its first action 2017-02-13 18:56:03 -05:00
Russell Yanofsky 9acf25cc01 Return error when importmulti called with invalid address.
Lack of error checking noticed by Alex Morcos <morcos@chaincode.com>
2017-02-13 17:54:51 -05:00
Takashi Mitsuta a432aa0aa8 Remove unused module from rpc-tests 2017-02-12 16:44:43 +09:00
Russell Yanofsky a80f98b1c7 Use importmulti timestamp when importing watch only keys
When importing a watch-only address over importmulti with a specific timestamp,
the wallet's nTimeFirstKey is currently set to 1. After this change, the
provided timestamp will be used and stored as metadata associated with
watch-only key. This can improve wallet performance because it can avoid the
need to scan the entire blockchain for watch only addresses when timestamps are
provided.

Also adds timestamp to validateaddress return value (needed for tests).

Fixes #9034.
2017-02-10 16:11:19 -05:00
Russell Yanofsky 266a8114cb Use MTP for importmulti "now" timestamps 2017-02-10 15:40:28 -05:00
Russell Yanofsky 3cf991756c Add test to check new importmulti "now" value
Easiest way to test this was to expose the timestamp via the validateaddress
RPC (which was already looking up and returning key metadata).
2017-02-10 15:40:28 -05:00
Russell Yanofsky 442887f27f Require timestamps for importmulti keys
Additionally, accept a "now" timestamp, to allow avoiding rescans for keys
which are known never to have been used.

Note that the behavior when "now" is specified is slightly different than the
previous behavior when no timestamp was specified at all. Previously, when no
timestamp was specified, it would avoid rescanning during the importmulti call,
but set the key's nCreateTime value to 1, which would not prevent future block
reads in later ScanForWalletTransactions calls. With this change, passing a
"now" timestamp will set the key's nCreateTime to the current block time
instead of 1.

Fixes #9491
2017-02-10 15:40:28 -05:00
MarcoFalke b860915f8b
Merge #9707: Fix RPC failure testing
9db8eec Fix RPC failure testing (John Newbery)
2017-02-10 18:02:56 +01:00
Matt Corallo 66f861ade9 Add a test for P2P inactivity timeouts 2017-02-09 17:34:03 -05:00
Matt Corallo b436f92f72 qa: Expose on-connection to mininode listeners 2017-02-08 12:05:13 -05:00
Matt Corallo 8aaba7a6b7 qa: mininode learns when a socket connects, not its first action 2017-02-08 12:05:13 -05:00
John Newbery 9db8eecac1 Fix RPC failure testing
Make sure that RPC tests are actually checking failures correctly by:

- Catching JSON RPC exceptions and verifying the error codes and messages.
- Failing the test case if the JSON RPC exception isn't raised.
2017-02-08 10:24:02 -05:00
Wladimir J. van der Laan b709fe7ffc
Merge #9532: Remove unused variables
90fd29b Remove unused int64_t nSinceLastSeen (practicalswift)
ac4a095 Remove unused Python variables (practicalswift)
2017-02-07 15:28:50 +01:00
John Newbery 3de3ccdfaa Refactor rpc-tests.py
- add main()
- remove global variables
2017-02-06 09:07:14 -05:00
John Newbery afd38e7cc8 Improve rpc-tests.py arguments
A few miscellaneous improvements to rpc-tests.py command line arguments:

 - make all arguments start with double dash for consistency
 - improve help text and output
 - add nozmq argument to explicitly exclude the ZMQ tests
 - change 'parallel' to 'jobs'
2017-02-06 08:55:16 -05:00
John Newbery 91bfffff5d Use argparse in rpc_tests.py
This commit replaces the roll-your-own argument parsing in rpc_tests.py
with Python's standard library argparse.
2017-02-06 08:51:27 -05:00
Wladimir J. van der Laan 40f7e27d25
Merge #9650: Better handle invalid parameters to signrawtransaction
6dbfe08 [qa] test signrawtransaction merge with missing inputs (Matt Corallo)
ec4f7e4 [qa] Add second input to signrawtransaction test case (Matt Corallo)
691710a [qa] Test that decoderawtransaction throws with extra data appended (Matt Corallo)
922bea9 Better handle invalid parameters to signrawtransaction (Matt Corallo)
7ea0ad5 Fail in DecodeHexTx if there is extra data at the end (Matt Corallo)
2017-02-06 14:51:00 +01:00
Matt Corallo 6dbfe08c29 [qa] test signrawtransaction merge with missing inputs 2017-02-02 17:40:49 -05:00
Russell Yanofsky 4ec057dfa7 [wallet] Set correct metadata on bumpfee wallet transactions
Preserve comment, order form, and account strings from the original wallet
transaction. Also set fTimeReceivedIsTxTime and fFromMe fields for consistency
with CWallet::CreateTransaction. The latter two fields don't influence current
wallet behavior, but do record that the transaction originated in the wallet
instead of coming from the network or sendrawtransaction.
2017-02-02 17:34:22 -05:00
Matt Corallo ec4f7e433e [qa] Add second input to signrawtransaction test case 2017-02-02 17:32:28 -05:00