Commit graph

188 commits

Author SHA1 Message Date
Ross Nicoll 5ad3dd615e Rename binaries to match Dogecoin 2015-10-31 14:49:39 +00:00
Patrick Lodder 6cee9dcd28 Bring back "target" property of getauxblock
Marked as deprecated but still used in many pool implementations,
as well as rpc-tests. This restores AuxPoW compatibility to 100%.
2015-10-13 16:56:14 +02:00
Patrick Lodder 4dce3af38e Add AUXPoW rpc tests
- Tests the auxpow rpc interface `getauxblock`
- Tests consensus constraints for auxpow:
  - Minimum block height
  - Valid scrypt proof of work
  - Foreign chain ID

This test requires the python package ltc_scrypt. Installation of
this module is scripted in qa/pull-tester/install-deps.sh and has
been integrated for travis CI.
2015-08-26 22:14:51 +02:00
Patrick Lodder 229106e27f fix rest.py test: cannot mine an auxpow block at height 1 2015-08-23 17:22:04 +02:00
langerhans 06639f4984 Make most of the RPC tests pass 2015-08-02 20:08:42 +02:00
Daniel Kraft eabf633f13 Merge AuxPoW support from Namecore
Includes the following commits:

commit 2ea1b5cd8cf2bdd08e43ae39fb76352eebe14895
commit f2a8220c34275f022f02d81e9e84d4cec33bd51c
commit 84b8b56113e6057b0253475b83e797dc1fed2eed
commit 8471d5db221f145f5a40022ed1897c1b996b628e
commit 2f125ad0a67e1b8f71b18a14a3b41d7e577391d1
commit e01dbc3608703b4cb4e9882738125f2b7816cdb8
commit f0421312631cd44669f9f84d339a0c470b4423b9
commit 1fd522db5dfddfd0e1b0c794b82fae2cc7bdb099
commit 71f63ad99f70ff6461c795fd728aea16aa1008f8
commit a7c44d98a8ded4df0e8455c4c5629b1a5b303bbf
commit e1d7b4fc15addf3dfeb3853fa66230a8bdacd75f
commit d016f2fa02572fd340129176b942b3f19bd5260b
commit f4716e5a168a697afce854a37350fdae0988bdd8
commit 03a575e3b13bf06cbb0a007d6672b05d2085c26e
commit d7ea37444bd9e9ac461a3dda0b16afefd160b062
commit db22affa01e050ff847a12e20c83b88952d80b59
commit 9b7e14986655f914b2d0903ca1d79367c92c6c7e
commit e21034f9c124893d5b9631e9ca231b0b9ede3d52

Changes are as below:

Wrap CBlockHeader::nVersion into a new class (CBlockVersion).  This allows to take care of interpreting the field into a base version, auxpow flag and the chain ID.

Update getauxblock.py for new 'generate' RPC call.

Add 'auxpow' to block JSON.

Accept auxpow as PoW verification.

Add unit tests for auxpow verification.

Add check for memory-layout of CBlockVersion.

Weaken auxpow chain ID checks for the testnet.

Allow Params() to overrule when to check the auxpow chain ID and for legacy blocks.  Use this to disable the checks on testnet.

Introduce CPureBlockHeader.

Split the block header part that is used by auxpow and the "real" block header (that uses auxpow) to resolve the cyclic dependency between the two.

Differentiate between uint256 and arith_uint256.

This change was done upstream, modify the auxpow code.

Add missing lock in auxpow_tests.

Fix REST header check for auxpow headers.

Those can be longer, thus take that into account.  Also perform the check actually on an auxpow header.

Correctly set the coinbase for getauxblock results.

Call IncrementExtraNonce in getauxblock so that the coinbase is actually initialised with the stuff it should be.  (BIP30 block height and COINBASE_FLAGS.)

Implement getauxblock plus regression test.

Turn auxpow test into FIXTURE test.

This allows using of the Params() calls.

Move CMerkleTx code to auxpow.cpp.

Otherwise we get linker errors when building without wallet.

Fix rebase with BIP66.

Update the code to handle BIP66's nVersion=3.

Enforce that auxpow parent blocks have no auxpow block version.

This is for compatibility with namecoind.  See also https://github.com/namecoin/namecoin/pull/199.

Move auxpow-related parameters to Consensus::Params.
2015-07-05 18:45:24 +01:00
Suhas Daftuar 2edec4fe68
P2P regression test for new AcceptBlock behavior
Github-Pull: #5875
Rebased-From: aa8c827968
2015-06-03 16:24:14 +02:00
Wladimir J. van der Laan 42746b0476
Merge pull request #6193
6e71efa [REST] remove json input for getutxos, limit to query max. 15 outpoints (Jonas Schnelli)
64b8027 rest.cpp: strip whitespace (Jonas Schnelli)
2015-06-01 09:48:17 +02:00
Jonas Schnelli 6e71efa9f0 [REST] remove json input for getutxos, limit to query max. 15 outpoints
Remove possibility to send json encoded parameters to `/rest/getutxos/` to avoid possible DoS scenarios.

The JSON output option is untouched.
2015-05-27 20:10:02 +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 7b7f258396 rpc-tests: remove python-bitcoinrpc directory
place authproxy.py at same level as other utility classes
2015-05-21 21:22:22 +02: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 00706a5436 update rpc-tests readme.md 2015-05-18 15:25:45 +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 64937fe51a [QA] restructure rpc tests directory
* move non-test classes to subdir `test-framework`
2015-05-18 15:25:45 +02:00
Alex Morcos 8f0947be34 Increase timeouts in pruning.py and modify warning language. 2015-05-13 15:02:36 -04:00
Wladimir J. van der Laan 2cc1372190
Merge pull request #5159
b649e03 Create new BlockPolicyEstimator for fee estimates (Alex Morcos)
2015-05-13 17:10:02 +02:00
Alex Morcos b649e03954 Create new BlockPolicyEstimator for fee estimates
This class groups transactions that have been confirmed in blocks into buckets, based on either their fee or their priority.  Then for each bucket, the class calculates what percentage of the transactions were confirmed within various numbers of blocks.  It does this by keeping an exponentially decaying moving history for each bucket and confirm block count of the percentage of transactions in that bucket that were confirmed within that number of blocks.

-Eliminate txs which didn't have all inputs available at entry from fee/pri calcs

-Add dynamic breakpoints and tracking of confirmation delays in mempool transactions

-Remove old CMinerPolicyEstimator and CBlockAverage code

-New smartfees.py

-Pass a flag to the estimation code, using IsInitialBlockDownload as a proxy for when we are still catching up and we shouldn't be counting how many blocks it takes for transactions to be included.

-Add a policyestimator unit test
2015-05-13 10:36:24 -04:00
Wladimir J. van der Laan c1409d11ad
Merge pull request #6073
a681663 clarify that there are only two nodes (Jameson Lopp)
2015-05-11 13:41:03 +02:00
Wladimir J. van der Laan 9ef00c363d
Merge pull request #5958
231072f [QA] add multisig rpc tests (Jonas Schnelli)
2015-05-07 13:18:43 +02:00
Jonas Schnelli 231072fe7b [QA] add multisig rpc tests 2015-05-07 11:05:23 +02:00
Wladimir J. van der Laan 1fd2d39529
Merge pull request #5420
6b4feb8 [QA] rest.py RPC test: change setgenerate() to generate() (Jonas Schnelli)
97ee866 [REST] getutxos REST command (based on Bip64) (Jonas Schnelli)
2015-05-06 16:50:05 +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
Wladimir J. van der Laan 00e76db8c2
Merge pull request #6085
b05a89b Non-grammatical language improvements (Luke Dashjr)
7e6d23b Bugfix: Grammar fixes (Corinne Dashjr)
2015-05-04 08:01:58 +02:00
Suhas Daftuar 2a22d4be9b Fix comptool send_message call when MAX_INV_SZ reached 2015-05-01 15:32:24 -04:00
Suhas Daftuar 574db4816f Fix potential race conditions in p2p testing framework
Previously, each NodeConnCB had its own lock to synchronize data structures
used by the testing thread and the networking thread, and NodeConn provided a
separate additional lock for synchronizing access to each send buffer.  This
commit replaces those locks with a single global lock (mininode_lock) that we
use to synchronize access to all data structures shared by the two threads.

Updates comptool and maxblocksinflight to use the new synchronization
semantics, eliminating previous race conditions within comptool, and re-enables
invalidblockrequest.py in travis.
2015-05-01 15:32:24 -04:00
Jonas Schnelli bba2216fc1 RPC test for "#5418 Report missing inputs in sendrawtransaction" 2015-05-01 15:30:10 +02:00
Corinne Dashjr 7e6d23b171 Bugfix: Grammar fixes 2015-05-01 11:21:27 +00:00
Suhas Daftuar 5487975ca3 Don't run invalidblockrequest.py in travis until race condition is fixed 2015-04-30 16:40:36 -04:00
Suhas Daftuar ef3281750d Fix mininode disconnections to work with select 2015-04-30 16:40:22 -04:00
Wladimir J. van der Laan da38dc696c
Merge pull request #5981
2703412 Fix default binary in p2p tests to use environment variable (Suhas Daftuar)
29bff0e Add some travis debugging for python scripts (Suhas Daftuar)
d76412b Add script manipulation tools for use in mininode testing framework (Suhas Daftuar)
b93974c Add comparison tool test runner, built on mininode (Suhas Daftuar)
6c1d1ba Python p2p testing framework (Suhas Daftuar)
2015-04-30 14:49:24 +02:00
Suhas Daftuar 2703412a39 Fix default binary in p2p tests to use environment variable 2015-04-29 09:18:33 -04:00
Wladimir J. van der Laan e08886d8a3
Merge pull request #6032
688da79 QA: add --noshutdown option to prevent stopping nodes (dexX7)
2eadeb2 QA: stop nodes after RPC tests, even with --nocleanup (dexX7)
2015-04-29 10:04:33 +02:00
Suhas Daftuar 29bff0e684 Add some travis debugging for python scripts
Adds printing to the console before/after calls to bitcoin-cli -rpcwait,
if the PYTHON_DEBUG environment variable is initialized.
2015-04-28 16:51:46 -04:00
Suhas Daftuar d76412b068 Add script manipulation tools for use in mininode testing framework
script.py is modified from the code in python-bitcoinlib, and provides tools
for manipulating and creating CScript objects.

bignum.py is a dependency for script.py

script_test.py is an example test that uses the script tools for running a test
that compares the behavior of two nodes, in a comptool- style test, for each of
the test cases in the bitcoin unit test script files, script_valid.json and
script_invalid.json.  (This test is very slow to run, but is a proof of concept
for how we can write tests to compare consensus-critical behavior between
different versions of bitcoind.)

bipdersig-p2p.py is another example test in the comptool framework, which tests
deployment of BIP DERSIG for a single node.  It uses the script.py tools for
manipulating signatures to be non-DER compliant.
2015-04-28 15:09:29 -04: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
Wladimir J. van der Laan 6364408122
Merge pull request #5199
1ec900a Remove broken+useless lock/unlock log prints (Matt Corallo)
352ed22 Add merkle blocks test (Matt Corallo)
59ed61b Add RPC call to generate and verify merkle blocks (Matt Corallo)
30da90d Add CMerkleBlock constructor for tx set + block and an empty one (Matt Corallo)
2015-04-28 10:07:25 +02:00
Jameson Lopp a681663e28 clarify that there are only two nodes 2015-04-27 20:22:06 -04:00
Wladimir J. van der Laan 585b5dba74
Merge pull request #6036
f89b092 add rpc test for listunspents support for zero value txouts (Jonas Schnelli)
219953c Show zero value txouts in listunspent. (Gregory Maxwell)
2015-04-24 14:57:43 +02:00
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