Commit Graph

72 Commits

Author SHA1 Message Date
Jack Grigg 07064ea2d1
GBT: Add RPC tests 2016-10-21 23:38:37 -05:00
zkbot ec8dc3a88a Auto merge of #1431 - bitcartel:master_1373_taddr_coinbase_error, r=bitcartel
Return a more informative error message when trying to spend coinbase; select non-coinbase inputs when sending to a transparent output if needed

For #1373 and #1519

Code change:
- Extra parameter added to AvailableCoins to include or exclude Coinbase coins.  Default value of parameter is 'true' as current behaviour is to include Coinbase coins.
- SelectCoins, used for sending taddr->taddr, will now exclude Coinbase coins.

Unit test:
Tried to write a test to focus on the extra parameter added to AvailableCoins but could not.

Empirical testing on Testnet:
Current behaviour is that upstream RPC commands sendfrom and sendtoaddress try to spend coinbase coins returned by AvailableCoins.  So the user will see:

```
./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 1000.0
error: {"code":-6,"message":"Insufficient funds"}

./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
error: {"code":-4,"message":"Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."}

./zcash-cli sendfrom "" mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
error: {"code":-4,"message":"Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."}
```

After fix is applied:

```
./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 1000.0
error: {"code":-6,"message":"Insufficient funds"}

./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
error: {"code":-4,"message":"Coinbase funds can only be sent to a zaddr"}
```

When non-coinbase UTXOs exist, they will now be selected and used:

```
./zcash-cli z_sendmany tnPJZHeVxegCg91utaquBRPEDBGjozfz9iLDHt7zvphFbZdspNgkTVLCGjDcadQBKNyUwKs8pNjDXuEZKrE1aNLpFwHgz4t '[{"address":"mx5fTRhLZwbYE7ZqhAPueZgQGSnwTbdvKU", "amount":0.01}]'

./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 1000.0
error: {"code":-6,"message":"Insufficient funds"}

./zcash-cli sendtoaddress mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
9818e543ac2f689d4ce8b52087607d73fecd771d45d316a1d9db092f0485aff2

./zcash-cli sendfrom "" mrEGRmGJhmwAa4MQjzGd86ry63vrvovu9b 0.00003000
899f2894823f51f15fc73b5e0871ac943edbe0ff88e1635f86906087b72caf30
```
2016-10-16 22:08:07 -04:00
Simon 2b1cda3b6a Return improved error message when trying to spend Coinbase coins (#1373).
Extra parameter added to AvailableCoins to include or exclude Coinbase coins.
SelectCoins, used for sending taddr->taddr, will exclude Coinbase coins.

Added qa rpc test and a runtime parameter -regtestprotectcoinbase to enforce
the coinbase->zaddr consensus rule in regtest mode.
2016-10-16 19:05:56 -07:00
Jack Grigg 52fdce985f
Add RPC test showing correct handling of JS txns from blockchain
For unencrypted wallets, the wallet correctly tracks JoinSplits made for their
zkey in a different wallet.
2016-10-14 17:14:13 -05:00
Sean Bowe 6e33353ea2 Rename pour RPC tests 2016-07-18 10:06:18 -06:00
Taylor Hornby 57c074e1e4 Enable -alertnotify for hard fork detection. Test it. 2016-06-09 13:48:04 -06:00
Nathan Wilcox 4259e1e3dd Log all failing rpc tests concisely. 2016-04-08 14:50:52 -07:00
Nathan Wilcox bb9f19b487 Run all RPC tests, even when they fail. 2016-04-07 17:13:29 -07:00
Sean Bowe d66877afb3 Added mapSerials consensus rules to prohibit double-spending. 2016-01-19 14:36:09 -07:00
Sean Bowe 0a87fc4ad0 Increase timeouts for comparison utility. 2016-01-19 14:36:09 -07:00
Sean Bowe 730790f7a4 Added primitive zcrawkeygen/zcrawpour implementations 2016-01-19 14:36:04 -07:00
Taylor Hornby 8a18333567 Rename .bitcoin (DataDir), bitcoind, and bitcoin-cli. 2015-11-30 13:03:21 -07:00
Cory Fields 13bd5a75b5 rpc-tests: re-enable rpc-tests for Windows 2015-09-22 00:43:14 +00:00
Suhas Daftuar 2edec4fe68
P2P regression test for new AcceptBlock behavior
Github-Pull: #5875
Rebased-From: aa8c827968a68a3adc4df5f126635e37a71a7fbb
2015-06-03 16:24:14 +02:00
Suhas Daftuar ee9a2e4271 Fix walletbackup.py after directory restructuring
Also add walletbackup.py to rpc-tests.sh
2015-05-27 10:00:15 -04:00
Jonas Schnelli a85b2e221b pull-tester/rpc-tests.sh: disable script_test.py test 2015-05-19 16:41:17 +02:00
Jonas Schnelli 3e875b1bef pull-tester/rpc-tests.sh: allow passing throug of arguments 2015-05-18 15:29:20 +02:00
Jonas Schnelli 344e08ed16 extend rpc-tests.sh control script with non-travis tests 2015-05-18 15:25:45 +02:00
Jonas Schnelli 231072fe7b [QA] add multisig rpc tests 2015-05-07 11:05:23 +02:00
dexX7 a71ab10f99
QA: add RPC tests for error reporting of "signrawtransaction"
Tests error reporting of transaction signing via RPC call "signrawtransaction".

Expected results:

Test 1: create and sign a valid raw transaction with one input:
- 1) The transaction has a complete set of signatures
- 2) No script verification error occurred

Test 2: create and sign a raw transaction with one valid, one invalid and one missing input script:
- 3) The transaction has no complete set of signatures
- 4) Two script verification errors occurred
- 5) Script verification errors have certain properties ("txid", "vout", "scriptSig", "sequence", "error")
- 6) The verification errors refer to the invalid (vin 1) and missing input (vin 2)
2015-05-05 10:09:39 +02:00
Wladimir J. van der Laan 16341cc15c
Merge pull request #5418
bba2216 RPC test for "#5418 Report missing inputs in sendrawtransaction" (Jonas Schnelli)
de8e801 Report missing inputs in sendrawtransaction (Pieter Wuille)
2015-05-04 12:42:26 +02:00
Jonas Schnelli bba2216fc1 RPC test for "#5418 Report missing inputs in sendrawtransaction" 2015-05-01 15:30:10 +02:00
Suhas Daftuar b93974c3f3 Add comparison tool test runner, built on mininode
comptool.py creates a tool for running a test suite on top of the mininode p2p
framework.  It supports two types of tests: those for which we expect certain
behavior (acceptance or rejection of a block or transaction) and those for
which we are just comparing that the behavior of 2 or more nodes is the same.

blockstore.py defines BlockStore and TxStore, which provide db-backed maps
between block/tx hashes and the corresponding block or tx.

blocktools.py defines utility functions for creating and manipulating blocks
and transactions.

invalidblockrequest.py is an example test in the comptool framework, which
tests the behavior of a single node when sent two different types of invalid
blocks (a block with a duplicated transaction and a block with a bad coinbase
value).
2015-04-28 12:40:56 -04:00
Suhas Daftuar 6c1d1ba6fc Python p2p testing framework
mininode.py provides a framework for connecting to a bitcoin node over the p2p
network. NodeConn is the main object that manages connectivity to a node and
provides callbacks; the interface for those callbacks is defined by NodeConnCB.
Defined also are all data structures from bitcoin core that pass on the network
(CBlock, CTransaction, etc), along with de-/serialization functions.

maxblocksinflight.py is an example test using this framework that tests whether
a node is limiting the maximum number of in-flight block requests.

This also adds support to util.py for specifying the binary to use when
starting nodes (for tests that compare the behavior of different bitcoind
versions), and adds maxblocksinflight.py to the pull tester.
2015-04-28 12:38:29 -04:00
Matt Corallo 352ed22c2c Add merkle blocks test 2015-04-23 21:19:15 -07:00
Wladimir J. van der Laan 6be3562e50 rpc-tests: Add proxy test
Add test for -proxy, -onion and -proxyrandomize.
2015-04-20 15:04:33 +02:00
Wladimir J. van der Laan e3f5727590
Merge pull request #5612
84d9199 [QA] fix zapwallettxes test (Jonas Schnelli)
2015-01-08 11:51:51 +01:00
Jonas Schnelli 84d919974b [QA] fix zapwallettxes test
- remove shell test script and add a python equivalent
2015-01-07 16:41:12 +01:00
Pieter Wuille 1c52aad540 Require sufficent priority for relay of free transactions 2014-12-30 02:03:29 +01:00
Jonas Schnelli 1340f00200 [RPC-TESTS] ability to run single test manually
adds possibility to run ./qa/pull-tester/rpc-tests.sh <TESTNAME>
2014-12-16 11:06:17 +01:00
Gavin Andresen 34318d7fad RPC-test based on invalidateblock for mempool coinbase spends 2014-12-08 14:09:58 -08:00
Jonas Schnelli 11d7a7d505 [RPC] add rpc-test for http keep-alive (persistent connections) 2014-12-06 23:15:22 +01:00
Wladimir J. van der Laan c2d7c6134e
Merge pull request #5407
9e56532 Coinbases-in-mempool regression test (Gavin Andresen)
2014-12-03 10:51:36 +01:00
Gavin Andresen 9e56532959
Coinbases-in-mempool regression test
Immature coinbase spends are allowed in the memory pool if they can be mined in the next block.
They are not allowed in the memory pool if they cannot be mined in the next block.

This regression test tests those edge cases.
2014-12-02 19:07:39 -05:00
Gavin Andresen 1c7e09f0b9
Merge pull request #5369
b2d0162 Test resurrecting memory pool transactions during chain re-org (Gavin Andresen)
3dd8ed7 Delay writing block indexes in invalidate/reconsider (Pieter Wuille)
798faec Add 'invalidateblock' and 'reconsiderblock' RPC commands. (Pieter Wuille)
2014-12-02 11:59:41 -05:00
Gavin Andresen b2d0162ba4
Test resurrecting memory pool transactions during chain re-org
Builds on #5316.
2014-12-02 11:09:25 -05:00
Jonas Schnelli 01dc2d83f8 [REST] add REST interface tests in rpc-test section 2014-12-01 12:52:21 +01:00
Pieter Wuille 1b91be49f5 Report status of chain tips 2014-11-27 11:50:14 +01:00
Wladimir J. van der Laan 37c47e1809
Merge pull request #5333
e4ef724 Edited rpc-tests to run python script not shell script. (mrbandrews)
189fb52 Port of wallet.sh to python (wallet.py). (mrbandrews)
2014-11-21 13:48:41 +01:00
mrbandrews e4ef724493 Edited rpc-tests to run python script not shell script. 2014-11-20 15:36:34 -05:00
Gavin Andresen 8656dbb095
Port/fix txnmall.sh regression test
Ported txnmall.sh to Python, and updated to match
recent transaction malleability changes.

I also modified it so it tests both double-spending
confirmed and unconfirmed (only-in-mempool) transactions.

Renamed to txn_doublespend, since that is really what is
being tested. And told the pull-tester to run both
variations on this test.
2014-11-19 15:36:10 -05:00
Cory Fields 3c30f27f34
travis: disable rpc tests for windows until they're not so flaky 2014-11-17 14:17:04 -05:00
Cory Fields c8b115e20b travis: temporarily disable the forknotify test
It appears to be breaking randomly on Windows
2014-11-13 04:09:19 -05:00
Cory Fields 7667850dbf tests: replace the old (unused since Travis) tests with new rpc test scripts 2014-10-31 00:05:55 -04:00
Cory Fields fa7f8cdc1a tests: remove old pull-tester scripts
They're unused since the switch to Travis
2014-10-31 00:05:55 -04:00
Michael Ford 214091d584 Update license in pull-tester and rpc-tests
Add missing copyright/license header where necessary
2014-10-23 09:48:19 +08:00
Pieter Wuille e11b2ce4c6 Fix large reorgs 2014-10-14 16:13:42 -07:00
Gavin Andresen dbca89b74b
Trigger -alertnotify if network is upgrading without you
This adds a -regetest-only undocumented (for regression testing only)
command-line option -blockversion=N to set block.nVersion.

Adds to the "has the rest of the network upgraded to a
block.nVersion we don't understand" code so it calls
-alertnotify when 51 of the last 100 blocks are up-version.
But it only alerts once, not with every subsequent new, upversion
block.

And adds a forknotify.py regression test to make sure it works.

Tested using forknotify.py:

Before adding CAlert::Notify, get:
Assertion failed: -alertnotify did not warn of up-version blocks

Before adding code to only alert once:
Assertion failed: -alertnotify excessive warning of up-version blocks

After final code in this pull:
Tests successful
2014-10-09 10:28:27 -04:00
Cory Fields 5ad450a65a travis: If the comparison-tool fails, dump the tail of the debug log
The entire debug log would be huge, and could cause issues for automated tools
like travis. Printing 200 lines is an initial guess at a reasonable number,
more may be required.
2014-10-01 16:47:33 -04:00
Cory Fields 9322f1a4d9 tests: fix test-runner for osx. Closes ##4708
Use the more portable $$ rather than $BASHPID
2014-08-15 23:17:43 -04:00