Commit graph

188 commits

Author SHA1 Message Date
mrbandrews 0421c18f3a Fix CheckBlockIndex for reindex.
Some tests in CheckBlockIndex require chainActive.Tip(), but when reindexing, chainActive has not been set on the first call to CheckBlockIndex.

reindex.py starts a node, mines 3 blocks, stops, and reindexes with CheckBlockIndex enabled.
2015-04-14 14:10:19 -04:00
Wladimir J. van der Laan 4ac79f99b0
Fix travis after merging #5957
New wallet tests have been added in the meantime and need to be updated
to use `generate` instead of `setgenerate`.
2015-04-09 17:36:10 +02:00
Wladimir J. van der Laan 57026a29bc
Merge pull request #5957
e2edf95 Bugfix: make CreateNewBlock return pindexPrev (Pieter Wuille)
6b04508 Introduce separate 'generate' RPC call (Pieter Wuille)
0df67f1 Simplify hash loop code (Pieter Wuille)
2015-04-09 15:23:09 +02:00
Pieter Wuille 6b04508e37 Introduce separate 'generate' RPC call 2015-04-01 11:47:10 -07:00
Jonas Schnelli 77650cc9f4 add -walletbroadcast=0 rpc test 2015-04-01 13:03:39 +02:00
Gavin Andresen 0f5954c434
Regression test for ResendWalletTransactions
Adds a regression test for the wallet's ResendWalletTransactions function, which uses a new, hidden RPC command "resendwallettransactions."

I refactored main's Broadcast signal so it is passed the best-block time, which let me remove a global variable shared between main.cpp and the wallet (nTimeBestReceived).

I also manually tested the "rebroadcast unconfirmed every half hour or so" functionality by:

1. Running bitcoind -connect=0.0.0.0:8333
2. Creating a couple of send-to-self transactions
3. Connect to a peer using -addnode
4. Waited a while, monitoring debug.log, until I see:
```2015-03-23 18:48:10 ResendWalletTransactions: rebroadcast 2 unconfirmed transactions```

One last change: don't bother putting ResendWalletTransactions messages in debug.log unless unconfirmed transactions were actually rebroadcast.
2015-03-24 15:29:20 -04:00
Wladimir J. van der Laan 22cfe23196
Merge pull request #5890
cd3d67c Fix InvalidateBlock to add chainActive.Tip to setBlockIndexCandidates (Alex Morcos)
2015-03-24 14:50:54 +01:00
Wladimir J. van der Laan df5c246ba3
Merge pull request #5831
1d9b378 qa/rpc-tests/wallet: Tests for sendmany (Luke Dashjr)
40a7573 rpcwallet/sendmany: Just take an array of addresses to subtract fees from, rather than an Object with all values being identical (Luke Dashjr)
292623a Subtract fee from amount (Cozz Lovan)
90a43c1 [Qt] Code-movement-only: Format confirmation message in sendcoinsdialog (Cozz Lovan)
2015-03-16 12:23:14 +01:00
Alex Morcos cd3d67cf3b Fix InvalidateBlock to add chainActive.Tip to setBlockIndexCandidates 2015-03-13 13:11:11 -04:00
Luke Dashjr 1d9b378c30 qa/rpc-tests/wallet: Tests for sendmany 2015-03-13 11:04:25 +01:00
Cozz Lovan 292623adf5 Subtract fee from amount
Fixes #2724 and #1570.

Adds the
automatically-subtract-the-fee-from-the-amount-and-send-whats-left
feature to the GUI and RPC (sendtoaddress,sendmany).
2015-03-13 11:04:18 +01:00
Alex Morcos 88f6c8c365 add RPC test for InvalidateBlock 2015-03-12 10:15:33 -04:00
Wladimir J. van der Laan d48ce48093
Merge #5548: [REST] add /rest/chaininfos
2c0f901 [REST] rest/chaininfos add documentation (Jonas Schnelli)
59582c8 [REST] add /rest/chaininfos (Jonas Schnelli)
2015-02-10 12:08:07 +01:00
Suhas Daftuar 1cb2a00cb8 Fix getblocktemplate_proposals test by mining one block
This triggers the tested node to no longer be in initial
download, allowing the call to getblocktemplate() to succeed.
2015-02-04 12:04:49 -05:00
Wladimir J. van der Laan 41e6e4caba
Merge pull request #5713
bf6cdeb Increase coverage of DERSIG edge cases (Pieter Wuille)
819bcf9 Add RPC test for DERSIG BIP switchover logic (Pieter Wuille)
5a47811 BIP66 changeover logic (Pieter Wuille)
092e9fe Example unit tests from BIP66 (Pieter Wuille)
80ad135 Change IsDERSignature to BIP66 implementation (Pieter Wuille)
2015-02-03 10:34:53 +01:00
Pieter Wuille 819bcf9b99 Add RPC test for DERSIG BIP switchover logic 2015-02-01 17:51:24 -04:00
bikinibabe ee932025c1 Changed pronouns for correctness and inclusivity 2015-01-31 17:38:28 -05:00
Matt Bogosian 34c61813a4 Fix README link from util.sh -> util.py. 2015-01-31 17:38:28 -05:00
Jonas Schnelli 1a25a7edf8 [QA] fix httpbasic keep-alive test 2015-01-17 08:56:55 -08:00
Jonas Schnelli 1dd8ee72af improve tests for #5655 2015-01-14 09:50:00 -08:00
Wladimir J. van der Laan 56c1093dae fix tests for #5655 2015-01-14 09:50:00 -08: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
Suhas Daftuar 1eb1e65f09 Fix smartfees test for change to relay policy 2015-01-07 10:11:23 -05:00
Wladimir J. van der Laan d79adc1ab1
Merge pull request #5535
1c52aad Require sufficent priority for relay of free transactions (Pieter Wuille)
2015-01-07 13:01:56 +01:00
Pieter Wuille 1c52aad540 Require sufficent priority for relay of free transactions 2014-12-30 02:03:29 +01:00
Jonas Schnelli 59582c8b8d [REST] add /rest/chaininfos 2014-12-29 20:19:48 +01:00
Jonas Schnelli 12d927a391 RPC test for immature balance 2014-12-25 20:15:10 -08:00
Wladimir J. van der Laan 111a7d45f1
Merge pull request #5470
78253fc Remove references to X11 licence (Michael Ford)
2014-12-19 19:23:23 +01:00
Jonas Schnelli 7a3b83269e [QA] fix httpbasics RPC test typo 2014-12-17 22:40:20 +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
Michael Ford 78253fcbad Remove references to X11 licence 2014-12-16 15:56:50 +08:00
Pieter Wuille f676c80f43 Add /rest/headers 2014-12-12 16:37:00 +01:00
Wladimir J. van der Laan 41cced2106
Merge pull request #5267
34318d7 RPC-test based on invalidateblock for mempool coinbase spends (Gavin Andresen)
7fd6219 Make CTxMemPool::remove more effecient by avoiding recursion (Matt Corallo)
b7b4318 Make CTxMemPool::check more thourough by using CheckInputs (Matt Corallo)
723d12c Remove txn which are invalidated by coinbase maturity during reorg (Matt Corallo)
868d041 Remove coinbase-dependant transactions during reorg. (Matt Corallo)
2014-12-11 15:24:00 +01:00
Jonas Schnelli 73351c3686 [REST] /rest/block response with full tx details
- rest block request returns full unfolded tx details
- /rest/block/notxdetails/<HASH> returns block where transactions are only represented by its hash
2014-12-09 16:05:50 +01:00
mrbandrews 1577df986e Port of walletbackup.sh to Python. 2014-12-09 10:57:51 +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
Matt Corallo db0916bd13 Fix missing python2 in rpc-tests 2014-12-05 16:04:05 -08: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
Wladimir J. van der Laan 90f7aa7778
Fix rest.py test after #5376 2014-12-02 15:57:20 +01:00
Jonas Schnelli 01dc2d83f8 [REST] add REST interface tests in rpc-test section 2014-12-01 12:52:21 +01:00
Wladimir J. van der Laan 0ddf4416cc
Merge pull request #5386
1b91be4 Report status of chain tips (Pieter Wuille)
2014-12-01 11:49:35 +01:00
Pieter Wuille 1b91be49f5 Report status of chain tips 2014-11-27 11:50:14 +01:00
Matt Corallo e3f315a0a5 Fix python usage for arch's broken maintainers 2014-11-27 00:02:28 -05:00
Gavin Andresen fe042dbe9f
Merge pull request #5335
7e615f5 Fixed mempool sync after sending a transaction (Suhas Daftuar)
2014-11-24 10:27:37 -05:00
Wladimir J. van der Laan f24bcce2ac
Merge pull request #1816
b867e40 CreateNewBlock: Stick height in coinbase so we pass template sanity check (Luke Dashjr)
60755db submitblock: Check for duplicate submissions explicitly (Luke Dashjr)
bc6cb41 QA RPC tests: Add tests block block proposals (Luke Dashjr)
9765a50 Implement BIP 23 Block Proposal (Luke Dashjr)
3dcbb9b Abstract DecodeHexBlk and BIP22ValidationResult functions out of submitblock (Luke Dashjr)
132ea9b miner_tests: Disable checkpoints so they don't fail the subsidy-change test (Luke Dashjr)
df08a62 TestBlockValidity function for CBlock proposals (used by CreateNewBlock) (Luke Dashjr)
4ea1be7 CreateNewBlock and miner_tests: Also check generated template is valid by CheckBlockHeader, ContextualCheckBlockHeader, CheckBlock, and ContextualCheckBlock (Luke Dashjr)
a48f2d6 Abstract context-dependent block checking from acceptance (Luke Dashjr)
2014-11-24 14:43:10 +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
Suhas Daftuar 7e615f5228 Fixed mempool sync after sending a transaction 2014-11-20 15:49:07 -05:00
mrbandrews e4ef724493 Edited rpc-tests to run python script not shell script. 2014-11-20 15:36:34 -05:00
mrbandrews 189fb526f1 Port of wallet.sh to python (wallet.py).
Also included are minor edits to util.py to create a clean blockchain and add a parameter to gather_inputs to specify number of confirmations.
2014-11-20 14:11:44 -05:00
Luke Dashjr bc6cb4177b QA RPC tests: Add tests block block proposals 2014-11-20 00:15:17 +00: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
Gavin Andresen fd3777b0b2
Merge pull request #5280
3c30f27 travis: disable rpc tests for windows until they're not so flaky (Cory Fields)
daf03e7 RPC tests: create initial chain with specific timestamps (Gavin Andresen)
a8b2ce5 regression test only setmocktime RPC call (Gavin Andresen)
2014-11-18 14:31:29 -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
Gavin Andresen daf03e7c92
RPC tests: create initial chain with specific timestamps
Use setmocktime to create the initial block chain with
10-minute-apart-blocks starting 1 Jan 2014.
2014-11-17 14:13:32 -05:00
Wladimir J. van der Laan 20e4f654f5
Merge pull request #5237
2db4c8a Fix node ranges in the test framework. (Daniel Kraft)
2014-11-17 17:20:32 +01:00
Bryan Bishop a7af9839d6 don't override dir() in qa rpc tests
Replace "dir" with "dirname" in util.py in qa/rpc-tests/ because "dir"
is the name of a function in python.
2014-11-14 09:12:41 -06: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
dexX7 5e2dcaebc4
gather_inputs: use correct variable in error message
"amount" and "fee" do not exist (anymore?).
2014-11-07 15:47:29 +01:00
Daniel Kraft 2db4c8a24d Fix node ranges in the test framework. 2014-11-07 10:23:21 +01: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
Cory Fields 5122ea7190 tests: fix forknotify.py on windows
Windows interprets 'foo.txt' as a literal filename while "foo.txt" is treated
as expected.
2014-10-31 00:05:55 -04:00
Cory Fields 7a41614aa2 tests: allow rpc-tests to get filenames for bitcoind and bitcoin-cli from the environment
This will allow for windows tests to run with bitcoind.exe and bitcoin-cli.exe
2014-10-31 00:05:55 -04:00
Gavin Andresen e4f79c0219
Merge pull request #5139
9f87325 Start with tidier cache directories (Gavin Andresen)

Signed-off-by: Gavin Andresen <gavinandresen@gmail.com>
2014-10-27 13:39:25 -04:00
Wladimir J. van der Laan b6c99efe9c
Merge pull request #5121
214091d Update license in pull-tester and rpc-tests (Michael Ford)
2014-10-27 13:48:45 +01:00
Gavin Andresen 9f87325b22
Start with tidier cache directories
Remove more files from the cached, 200-block-chain data directories.
2014-10-24 15:48:06 -04:00
Gavin Andresen e401a2c557
Merge pull request #5132
2290ed0 Work around #5113. (Daniel Kraft)
dcb9846 Extend getchaintips RPC test. (Daniel Kraft)

Signed-off-by: Gavin Andresen <gavinandresen@gmail.com>
2014-10-24 15:13:41 -04:00
Gavin Andresen ec01243c14
--tracerpc option for regression tests
Run tests with --tracerpc and all RPC calls will dump to the console.
Very helpful for debugging.
2014-10-24 11:27:22 -04:00
Daniel Kraft 2290ed01bc Work around #5113. 2014-10-24 09:06:37 +02:00
Daniel Kraft dcb98466b4 Extend getchaintips RPC test.
Add the capability to simulate network splits to the RPC test framework
and use it to do more extensive testing of 'getchaintips'.
2014-10-24 08:53:04 +02: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
Cory Fields 005b5af6e2 rpc-tests: don't spew non-errors to stdout
There's a brief race here, the process might've already exited and cleaned up
after itself. If that's the case, reading from the pidfile will harmlessly
fail. Keep those quiet.
2014-10-10 13:11:49 -04: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
Luke Dashjr 0b17964131 Bugfix: Replace bashisms with standard sh in tests/tools 2014-10-03 23:45:26 +00: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
Gavin Andresen 3a7c3483b6 Fix make_change to not create half-satoshis 2014-09-05 09:33:13 -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
Wladimir J. van der Laan ab676c3ac4
Merge pull request #4612
6548cc9 test: don't let the port number exceed the legal range (Cory Fields)
a67eef1 test: redirect comparison tool output to stdout (Cory Fields)
2014-08-04 16:55:10 +02:00
Daniel Kraft b33bd7a3be Implement "getchaintips" RPC command to monitor blockchain forks.
Port over https://github.com/chronokings/huntercoin/pull/19 from
Huntercoin:  This implements a new RPC command "getchaintips" that can be
used to find all currently active chain heads.  This is similar to the
-printblocktree startup option, but it can be used without restarting
just via the RPC interface on a running daemon.
2014-08-03 18:12:19 +02:00
Cory Fields 6548cc9f90 test: don't let the port number exceed the legal range 2014-07-31 14:08:22 -04:00
Gavin Andresen 4a56345a74 Merge pull request #4522 from dgenr8/set_discover_0
Set -discover=0 in regtest framework
2014-07-15 10:29:18 -04:00
Wladimir J. van der Laan c9bc398ad9
Merge pull request #4378
dc942e6 Introduce whitelisted peers. (Pieter Wuille)
2014-07-14 10:23:39 +02:00
Wladimir J. van der Laan 3554df9b99
Merge pull request #4503
b45a6e8 Add test for getblocktemplate longpolling (Wladimir J. van der Laan)
ff6a7af getblocktemplate: longpolling support (Luke Dashjr)
2014-07-14 08:29:46 +02:00
Tom Harding cdf305eeb0 Set -discover=0 in regtest framework
The regtest framework is local, so often there is no need to
discover our external IP.  Setting -discover=0 in util.py works
around shutdown hang caused by GetExternalIP waiting in recv().
2014-07-13 10:41:12 -07:00
Wladimir J. van der Laan 6c37f7fd78 getrawchangeaddress should fail when keypool exhausted
An user on IRC reported an issue where `getrawchangeaddress`
keeps returning a single address when the keypool is exhausted.
In my opinion this is strange behaviour.

- Change CReserveKey to fail when running out of keys in the keypool.
- Make `getrawchangeaddress` return RPC_WALLET_KEYPOOL_RAN_OUT when
  unable to create an address.
- Add a Python RPC test for checking the keypool behaviour in combination
  with encrypted wallets.
2014-07-11 15:24:29 +02:00
Wladimir J. van der Laan b45a6e8394 Add test for getblocktemplate longpolling 2014-07-11 14:48:16 +02:00
Pieter Wuille dc942e6f27 Introduce whitelisted peers.
This adds a -whitelist option to specify subnet ranges from which peers
that connect are whitelisted. In addition, there is a -whitebind option
which works like -bind, except peers connecting to it are also
whitelisted (allowing a separate listen port for trusted connections).

Being whitelisted has two effects (for now):
* They are immune to DoS disconnection/banning.
* Transactions they broadcast (which are valid) are always relayed,
  even if they were already in the mempool. This means that a node
  can function as a gateway for a local network, and that rebroadcasts
  from the local network will work as expected.

Whitelisting replaces the magic exemption localhost had for DoS
disconnection (local addresses are still never banned, though), which
implied hidden service connects (from a localhost Tor node) were
incorrectly immune to DoS disconnection as well. This old
behaviour is removed for that reason, but can be restored using
-whitelist=127.0.0.1 or -whitelist=::1 can be specified. -whitebind
is safer to use in case non-trusted localhost connections are expected
(like hidden services).
2014-07-09 20:40:14 +02:00
Gavin Andresen f5a92bf9bd
Print better errors, and add util stop_node() function. 2014-07-09 10:19:46 -04:00
Gavin Andresen e8097f7df1
Refactor common RPC test code to BitcoinTestFramework base class
Inspired by #3956, with a little more flexibility built in.

I didn't touch rpcbind_test.py, because it only runs on Linux.
2014-07-09 10:19:26 -04:00
Gavin Andresen 1b2bc71de1
Improved logging and Decimal support 2014-07-08 14:31:13 -04:00
Wladimir J. van der Laan 49d86c7477 rpc-tests: Fix rpcbind_test after 0193fb8
Port number for RPC is no longer static as multiple tests could be
running at once.
2014-06-27 10:06:40 +02:00
Wladimir J. van der Laan d4392c8989
Merge pull request #3674
77cbd46 Let -zapwallettxes recover transaction meta data (Cozz Lovan)
2014-06-24 17:04:52 +02:00
Wladimir J. van der Laan 3b1295e988
qa/rpc_tests: Wait for handshake to complete in connect_nodes
This avoids a race condition in which the connection was
made but the version handshake is not completed yet. In that
case transactions won't be broadcasted to a peer yet, and
the nodes will wait forever for their mempools to sync.
2014-06-23 17:43:55 +02:00
Wladimir J. van der Laan 0869df195c
Merge pull request #3960
3f9a019 added list/get received by address/ account tests (Alon Muroch)
2014-06-23 17:37:40 +02:00