Commit graph

597 commits

Author SHA1 Message Date
Matt Corallo
352ed22c2c Add merkle blocks test 2015-04-23 21:19:15 -07:00
dexX7
688da79e4a
QA: add --noshutdown option to prevent stopping nodes
With `--noshutdown`, the nodes are not stopped explicitly. `--noshutdown` implies `--nocleanup`, to prevent removing datadirs, which are still in use.
2015-04-23 14:19:00 +02:00
mrbandrews
f9ec3f0fad Add block pruning functionality
This adds a -prune=N option to bitcoind, which if set to N>0 will enable block
file pruning. When pruning is enabled, block and undo files will be deleted to
try to keep total space used by those files to below the prune target (N, in
MB) specified by the user, subject to some constraints:

- The last 288 blocks on the main chain are always kept (MIN_BLOCKS_TO_KEEP),
- N must be at least 550MB (chosen as a value for the target that could
  reasonably be met, with some assumptions about block sizes, orphan rates,
  etc; see comment in main.h),
- No blocks are pruned until chainActive is at least 100,000 blocks long (on
  mainnet; defined separately for mainnet, testnet, and regtest in chainparams
  as nPruneAfterHeight).

This unsets NODE_NETWORK if pruning is enabled.

Also included is an RPC test for pruning (pruning.py).

Thanks to @rdponticelli for earlier work on this feature; this is based in
part off that work.
2015-04-22 15:53:48 -04:00
Jonas Schnelli
6b4feb89a8 [QA] rest.py RPC test: change setgenerate() to generate() 2015-04-21 20:33:02 +02:00
Jonas Schnelli
97ee866549 [REST] getutxos REST command (based on Bip64)
has parts of @mhearn #4351
* allows querying the utxos over REST
* same binary input and outputs as mentioned in Bip64
* input format = output format
* various rpc/rest regtests
2015-04-21 20:26:49 +02:00
Jonas Schnelli
f89b092d75 add rpc test for listunspents support for zero value txouts 2015-04-21 02:25:35 -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
dexX7
2eadeb27ed
QA: stop nodes after RPC tests, even with --nocleanup
`--nocleanup` should provide a way to preserve test data, but should not have an impact on whether nodes are to be stopped after the test execution.

In particular, when currently running RPC tests with `--nocleanup`, then it may result in several active `bitcoind` processes, which are not terminated properly.
2015-04-20 13:09:29 +02:00
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
Tom Harding
defd2d55b7 Better txn_doublespend.py test
Remove reliance on accounting "move" ledger entries.  Instead,
create funding transactions (and deal with fee complexities).

Do not rely on broken SyncMetaData.  Instead expect double-spend
amount to be debited from the default "" account.
2015-04-11 19:05:54 -07: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
Cozz Lovan
77cbd4623e Let -zapwallettxes recover transaction meta data 2014-06-16 18:56:57 +02:00
Gavin Andresen
171ca7745e estimatefee / estimatepriority RPC methods
New RPC methods: return an estimate of the fee (or priority) a
transaction needs to be likely to confirm in a given number of
blocks.

Mike Hearn created the first version of this method for estimating fees.
It works as follows:

For transactions that took 1 to N (I picked N=25) blocks to confirm,
keep N buckets with at most 100 entries in each recording the
fees-per-kilobyte paid by those transactions.

(separate buckets are kept for transactions that confirmed because
they are high-priority)

The buckets are filled as blocks are found, and are saved/restored
in a new fee_estiamtes.dat file in the data directory.

A few variations on Mike's initial scheme:

To estimate the fee needed for a transaction to confirm in X buckets,
all of the samples in all of the buckets are used and a median of
all of the data is used to make the estimate. For example, imagine
25 buckets each containing the full 100 entries. Those 2,500 samples
are sorted, and the estimate of the fee needed to confirm in the very
next block is the 50'th-highest-fee-entry in that sorted list; the
estimate of the fee needed to confirm in the next two blocks is the
150'th-highest-fee-entry, etc.

That algorithm has the nice property that estimates of how much fee
you need to pay to get confirmed in block N will always be greater
than or equal to the estimate for block N+1. It would clearly be wrong
to say "pay 11 uBTC and you'll get confirmed in 3 blocks, but pay
12 uBTC and it will take LONGER".

A single block will not contribute more than 10 entries to any one
bucket, so a single miner and a large block cannot overwhelm
the estimates.
2014-06-06 10:44:57 -04:00
Gavin Andresen
0193fb82a6 Allow multiple regression tests to run at once
Choose ports at startup based on PID, so multiple regression tests
can run on the same system at the same time.
2014-06-06 10:34:18 -04:00
Wladimir J. van der Laan
b5ad5e783d Add Python test for -rpcbind and -rpcallowip
Add a new test, `rpcbind_test.py`, that extensively tests the new
`-rpcbind` functionality.
2014-05-13 07:23:23 +02:00
Wladimir J. van der Laan
1ab62973d3
Merge pull request #4074
d3081fa Removed LevelDB changes (super3)
2014-05-02 20:36:26 +02:00
Gavin Andresen
3e7dac9dad stop bitcoind/bitcoin-cli processes that might have been left running 2014-05-02 12:37:20 -04:00
super3
d3081fa231 Removed LevelDB changes
Syntax Highlighting
2014-05-01 12:10:06 -04:00
Gavin Andresen
cb4bdd18a7 Have pull-tester run the listtransactions.py regression test
This should show how to run a python-based regression test
successfully in the pull-tester environment.
2014-04-02 19:59:17 -04:00
Alon Muroch
3f9a01995e added list/get received by address/ account tests
fixed some annotations and cleaned a bit

received by tests

d
2014-04-02 09:12:44 +02:00
Gavin Andresen
d138598f63
Fix regression tests
Taught bitcoind to close the HTTP connection after it gets a 'stop' command,
to make it easier for the regression tests to cleanly stop.
Move bitcoinrpc files to correct location.
Tidied up the python-based regression tests.
2014-03-24 19:14:51 +01:00
Wladimir J. van der Laan
3fc6846181 Add licenses for tests and test data
- Add license headers to source files (years based on commit dates)
  in `src/test` as well as `qa`
- Add `README.md` to `src/test/data` specifying MIT license

Fixes #3848
2014-03-18 10:20:55 +01:00
Gavin Andresen
356cfe8306 Python-based regression tests
skeleton.py : a do-nothing test skeleton
listtransactions.py : start of regression test for listtransactions call
2014-02-28 15:24:31 -05:00
Gavin Andresen
93a18a3650 Remove CWalletTx::vfSpent
Use the spent outpoint multimap to figure out which wallet transaction
outputs are unspent, instead of a vfSpent array that is saved
to disk.
2014-02-26 11:53:51 -05:00
Gavin Andresen
a16ad1c0f4 Merge pull request #3704 from gavinandresen/wallet_lock_fixes
Wallet locking fixes for -DDEBUG_LOCKORDER
2014-02-24 14:39:23 -05:00
Gavin Andresen
41dcf61504 Test for walletbackup/walletdump RPC calls 2014-02-24 12:58:40 -05:00
Gavin Andresen
ca4cf5cff6 Wallet locking fixes for -DDEBUG_LOCKORDER
Compiling with -DDEBUG_LOCKORDER and running the qa/rpc-test/ regression
tests uncovered a couple of wallet methods that should (but didn't)
acquire the cs_wallet mutext.

I also changed the AssertLockHeld() routine print to stderr and
abort, instead of printing to debug.log and then assert()'ing.
It is annoying to look in debug.log to find out which
AssertLockHeld is failing.
2014-02-18 12:11:46 -05:00
Gavin Andresen
731b89b8b5 Track and report wallet transaction clones
Adds a "walletconflicts" array to transaction info; if
a wallet transaction is mutated, the alternate transaction id
or ids are reported there (usually the array will be empty).

Metadata from the original transaction is copied to the mutant,
so the transaction time and "from" account of the mutant are
reported correctly.
2014-02-14 18:13:42 -05:00
Gavin Andresen
2b72d46f42 Handle "conflicted" transactions properly
Extend CMerkleTx::GetDepthInMainChain with the concept of
a "conflicted" transaction-- a transaction generated by the wallet
that is not in the main chain or in the mempool, and, therefore,
will likely never be confirmed.

GetDepthInMainChain() now returns -1 for conflicted transactions
(0 for unconfirmed-but-in-the-mempool, and >1 for confirmed).

This makes getbalance, getbalance '*', and listunspent all agree when there are
mutated transactions in the wallet.

Before:
 listunspent: one 49BTC output
 getbalance: 96 BTC (change counted twice)
 getbalance '*': 46 BTC (spends counted twice)

After: all agree, 49 BTC available to spend.
2014-02-14 11:08:40 -05:00
Gavin Andresen
f582eda4ed Make qa/rpc-tests/ compatible with OSX
Reworked send.sh, so it works properly on my Mac (killall send.sh
doesn't work, because the process name is 'bash' not 'send.sh').
So now send.sh writes a .send.pid file, and invoking it as
send.sh -STOP (as the bitcoind -walletnotify) signals that PID.
2014-02-13 14:25:38 -05:00
Cory Fields
371f3f6ba5 qt5: fix --with-qt with no arguments 2014-01-10 16:30:33 -05:00
Wladimir J. van der Laan
5fe19d640e qt: make wallet test consistent
Add a function `WaitBlocks` to wait for blocks to propagate to all three
nodes, and use this instead of waiting a fixed time of one second.

Fixes #3445.
2013-12-20 17:12:39 +01:00
Gavin Andresen
9e7776bf1f Integration tests via RPC calls
qa/rpc-tests/wallet.sh runs a three-node -regtest network,
generates a fresh blockchain, and then exercises basic wallet
sending/receiving functionality using command-line RPC.
2013-11-27 14:21:05 +10:00
Brandon Dahler
2b91707469 Update build docs that refer to old makefile.* files.
Also update pull-tester's error message.
2013-11-10 21:36:13 -06:00
Matt Corallo
338d24bb00 Skip comparison tool on win32 since Wine breaks it 2013-11-04 00:40:39 -05:00
Matt Corallo
b2b7bf4bf9 Missed an RPC port 2013-10-28 03:53:35 -04:00
Matt Corallo
f1f72e535c Fix port binding by listening on port $BASHPID 2013-10-28 03:43:09 -04:00
Matt Corallo
a18a408067 Run block tester and test suite on Windows too (only on Jenkins) 2013-10-28 03:20:12 -04:00
Matt Corallo
473eabada2 Gracefully handle the case when a DISTDIR already exists 2013-10-28 03:12:14 -04:00
Matt Corallo
a27253dc00 pull-tester.py: Re-enable coverage msg, new args to run test script 2013-10-28 01:22:07 -04:00
Matt Corallo
47b9374e39 Make large-reorg tests optional in block-tester 2013-10-28 01:16:41 -04:00
Matt Corallo
95fa14da69 Re-enable BitcoindComparisonTool:
* Use the latest version, with limited memory usage, and path to
   on-disk db (try mouting qa/tmp on a tmpfs)\
 * enable -debug=net
 * re-enable BitcoindComparisonTool in pull-tester
2013-10-27 03:38:04 -04:00
Gavin Andresen
38a94488ce Disable code-coverage builds for now
Not working on the pull-tester machine, 'make cov' hangs there.
2013-10-11 14:50:02 +10:00
Gavin Andresen
0dd127a791 Rework pull-tester scripts, disable blockchain tester
Re-organize the pull-tester scripts a bit.

And disables running the blockchain tester, it is not working properly
on the pull-tester machine for reasons I cannot explain (fails to start).
2013-10-11 14:50:02 +10:00
Gavin Andresen
583484a656 Re-enable win32 pull-testing 2013-10-08 10:49:50 +10:00
Gavin Andresen
9196f38c8f Tweaks to the top-level pull-tester script 2013-09-20 15:55:05 +10:00
Gavin Andresen
3ee673a2c9 Rename BitcoinjBitcoindComparisonTool just BitcoindComparisonTool 2013-09-20 13:33:07 +10:00
Gavin Andresen
5d56b4574f Master pull-tester-driver python script 2013-09-20 08:49:36 +10:00
Cory Fields
35b8af9226 autotools: switch to autotools buildsystem 2013-09-05 21:31:03 -04:00