dash/qa/rpc-tests
gladcow bc45a2f87a Backport compact blocks functionality from bitcoin (#1966)
* Merge #8068: Compact Blocks

48efec8 Fix some minor compact block issues that came up in review (Matt Corallo)
ccd06b9 Elaborate bucket size math (Pieter Wuille)
0d4cb48 Use vTxHashes to optimize InitData significantly (Matt Corallo)
8119026 Provide a flat list of txid/terators to txn in CTxMemPool (Matt Corallo)
678ee97 Add BIP 152 to implemented BIPs list (Matt Corallo)
56ba516 Add reconstruction debug logging (Matt Corallo)
2f34a2e Get our "best three" peers to announce blocks using cmpctblocks (Matt Corallo)
927f8ee Add ability to fetch CNode by NodeId (Matt Corallo)
d25cd3e Add receiver-side protocol implementation for CMPCTBLOCK stuff (Matt Corallo)
9c837d5 Add sender-side protocol implementation for CMPCTBLOCK stuff (Matt Corallo)
00c4078 Add protocol messages for short-ids blocks (Matt Corallo)
e3b2222 Add some blockencodings tests (Matt Corallo)
f4f8f14 Add TestMemPoolEntryHelper::FromTx version for CTransaction (Matt Corallo)
85ad31e Add partial-block block encodings API (Matt Corallo)
5249dac Add COMPACTSIZE wrapper similar to VARINT for serialization (Matt Corallo)
cbda71c Move context-required checks from CheckBlockHeader to Contextual... (Matt Corallo)
7c29ec9 If AcceptBlockHeader returns true, pindex will be set. (Matt Corallo)
96806c3 Stop trimming when mapTx is empty (Pieter Wuille)

* Merge #8408: Prevent fingerprinting, disk-DoS with compact blocks

1d06e49 Ignore CMPCTBLOCK messages for pruned blocks (Suhas Daftuar)
1de2a46 Ignore GETBLOCKTXN requests for unknown blocks (Suhas Daftuar)

* Merge #8418: Add tests for compact blocks

45c7ddd Add p2p test for BIP 152 (compact blocks) (Suhas Daftuar)
9a22a6c Add support for compactblocks to mininode (Suhas Daftuar)
a8689fd Tests: refactor compact size serialization in mininode (Suhas Daftuar)
9c8593d Implement SipHash in Python (Pieter Wuille)
56c87e9 Allow changing BIP9 parameters on regtest (Suhas Daftuar)

* Merge #8505: Trivial: Fix typos in various files

1aacfc2 various typos (leijurv)

* Merge #8449: [Trivial] Do not shadow local variable, cleanup

a159f25 Remove redundand (and shadowing) declaration (Pavel Janík)
cce3024 Do not shadow local variable, cleanup (Pavel Janík)

* Merge #8739: [qa] Fix broken sendcmpct test in p2p-compactblocks.py

157254a Fix broken sendcmpct test in p2p-compactblocks.py (Suhas Daftuar)

* Merge #8854: [qa] Fix race condition in p2p-compactblocks test

b5fd666 [qa] Fix race condition in p2p-compactblocks test (Suhas Daftuar)

* Merge #8393: Support for compact blocks together with segwit

27acfc1 [qa] Update p2p-compactblocks.py for compactblocks v2 (Suhas Daftuar)
422fac6 [qa] Add support for compactblocks v2 to mininode (Suhas Daftuar)
f5b9b8f [qa] Fix bug in mininode witness deserialization (Suhas Daftuar)
6aa28ab Use cmpctblock type 2 for segwit-enabled transfer (Pieter Wuille)
be7555f Fix overly-prescriptive p2p-segwit test for new fetch logic (Matt Corallo)
06128da Make GetFetchFlags always request witness objects from witness peers (Matt Corallo)

* Merge #8882: [qa] Fix race conditions in p2p-compactblocks.py and sendheaders.py

b55d941 [qa] Fix race condition in sendheaders.py (Suhas Daftuar)
6976db2 [qa] Another attempt to fix race condition in p2p-compactblocks.py (Suhas Daftuar)

* Merge #8904: [qa] Fix compact block shortids for a test case

4cdece4 [qa] Fix compact block shortids for a test case (Dagur Valberg Johannsson)

* Merge #8637: Compact Block Tweaks (rebase of #8235)

3ac6de0 Align constant names for maximum compact block / blocktxn depth (Pieter Wuille)
b2e93a3 Add cmpctblock to debug help list (instagibbs)
fe998e9 More agressively filter compact block requests (Matt Corallo)
02a337d Dont remove a "preferred" cmpctblock peer if they provide a block (Matt Corallo)

* Merge #8975: Chainparams: Trivial: In AppInit2(), s/Params()/chainparams/

6f2f639 Chainparams: Trivial: In AppInit2(), s/Params()/chainparams/ (Jorge Timón)

* Merge #8968: Don't hold cs_main when calling ProcessNewBlock from a cmpctblock

72ca7d9 Don't hold cs_main when calling ProcessNewBlock from a cmpctblock (Matt Corallo)

* Merge #8995: Add missing cs_main lock to ::GETBLOCKTXN processing

dfe7906 Add missing cs_main lock to ::GETBLOCKTXN processing (Matt Corallo)

* Merge #8515: A few mempool removal optimizations

0334430 Add some missing includes (Pieter Wuille)
4100499 Return shared_ptr<CTransaction> from mempool removes (Pieter Wuille)
51f2783 Make removed and conflicted arguments optional to remove (Pieter Wuille)
f48211b Bypass removeRecursive in removeForReorg (Pieter Wuille)

* Merge #9026: Fix handling of invalid compact blocks

d4833ff Bump the protocol version to distinguish new banning behavior. (Suhas Daftuar)
88c3549 Fix compact block handling to not ban if block is invalid (Suhas Daftuar)
c93beac [qa] Test that invalid compactblocks don't result in ban (Suhas Daftuar)

* Merge #9039: Various serialization simplifcations and optimizations

d59a518 Use fixed preallocation instead of costly GetSerializeSize (Pieter Wuille)
25a211a Add optimized CSizeComputer serializers (Pieter Wuille)
a2929a2 Make CSerAction's ForRead() constexpr (Pieter Wuille)
a603925 Avoid -Wshadow errors (Pieter Wuille)
5284721 Get rid of nType and nVersion (Pieter Wuille)
657e05a Make GetSerializeSize a wrapper on top of CSizeComputer (Pieter Wuille)
fad9b66 Make nType and nVersion private and sometimes const (Pieter Wuille)
c2c5d42 Make streams' read and write return void (Pieter Wuille)
50e8a9c Remove unused ReadVersion and WriteVersion (Pieter Wuille)

* Merge #9058: Fixes for p2p-compactblocks.py test timeouts on travis (#8842)

dac53b5 Modify getblocktxn handler not to drop requests for old blocks (Russell Yanofsky)
55bfddc [qa] Fix stale data bug in test_compactblocks_not_at_tip (Russell Yanofsky)
47e9659 [qa] Fix bug in compactblocks v2 merge (Russell Yanofsky)

* Merge #9160: [trivial] Fix hungarian variable name

ec34648 [trivial] Fix hungarian variable name (Russell Yanofsky)

* Merge #9159: [qa] Wait for specific block announcement in p2p-compactblocks

dfa44d1 [qa] Wait for specific block announcement in p2p-compactblocks (Russell Yanofsky)

* Merge #9125: Make CBlock a vector of shared_ptr of CTransactions

b4e4ba4 Introduce convenience type CTransactionRef (Pieter Wuille)
1662b43 Make CBlock::vtx a vector of shared_ptr<CTransaction> (Pieter Wuille)
da60506 Add deserializing constructors to CTransaction and CMutableTransaction (Pieter Wuille)
0e85204 Add serialization for unique_ptr and shared_ptr (Pieter Wuille)

* Merge #8872: Remove block-request logic from INV message processing

037159c Remove block-request logic from INV message processing (Matt Corallo)
3451203 [qa] Respond to getheaders and do not assume a getdata on inv (Matt Corallo)
d768f15 [qa] Make comptool push blocks instead of relying on inv-fetch (mrbandrews)

* Merge #9199: Always drop the least preferred HB peer when adding a new one.

ca8549d Always drop the least preferred HB peer when adding a new one. (Gregory Maxwell)

* Merge #9233: Fix some typos

15fa95d Fix some typos (fsb4000)

* Merge #9260: Mrs Peacock in The Library with The Candlestick (killed main.{h,cpp})

76faa3c Rename the remaining main.{h,cpp} to validation.{h,cpp} (Matt Corallo)
e736772 Move network-msg-processing code out of main to its own file (Matt Corallo)
87c35f5 Remove orphan state wipe from UnloadBlockIndex. (Matt Corallo)

* Merge #9014: Fix block-connection performance regression

dd0df81 Document ConnectBlock connectTrace postconditions (Matt Corallo)
2d6e561 Switch pblock in ProcessNewBlock to a shared_ptr (Matt Corallo)
2736c44 Make the optional pblock in ActivateBestChain a shared_ptr (Matt Corallo)
ae4db44 Create a shared_ptr for the block we're connecting in ActivateBCS (Matt Corallo)
fd9d890 Keep blocks as shared_ptrs, instead of copying txn in ConnectTip (Matt Corallo)
6fdd43b Add struct to track block-connect-time-generated info for callbacks (Matt Corallo)

* Merge #9240: Remove txConflicted

a874ab5 remove internal tracking of mempool conflicts for reporting to wallet (Alex Morcos)
bf663f8 remove external usage of mempool conflict tracking (Alex Morcos)

* Merge #9344: Do not run functions with necessary side-effects in assert()

da9cdd2 Do not run functions with necessary side-effects in assert() (Gregory Maxwell)

* Merge #9273: Remove unused CDiskBlockPos* argument from ProcessNewBlock

a13fa4c Remove unused CDiskBlockPos* argument from ProcessNewBlock (Matt Corallo)

* Merge #9352: Attempt reconstruction from all compact block announcements

813ede9 [qa] Update compactblocks test for multi-peer reconstruction (Suhas Daftuar)
7017298 Allow compactblock reconstruction when block is in flight (Suhas Daftuar)

* Merge #9252: Release cs_main before calling ProcessNewBlock, or processing headers (cmpctblock handling)

bd02bdd Release cs_main before processing cmpctblock as header (Suhas Daftuar)
680b0c0 Release cs_main before calling ProcessNewBlock (cmpctblock handling) (Suhas Daftuar)

* Merge #9283: A few more CTransactionRef optimizations

91335ba Remove unused MakeTransactionRef overloads (Pieter Wuille)
6713f0f Make FillBlock consume txn_available to avoid shared_ptr copies (Pieter Wuille)
62607d7 Convert COrphanTx to keep a CTransactionRef (Pieter Wuille)
c44e4c4 Make AcceptToMemoryPool take CTransactionRef (Pieter Wuille)

* Merge #9375: Relay compact block messages prior to full block connection

02ee4eb Make most_recent_compact_block a pointer to a const (Matt Corallo)
73666ad Add comment to describe callers to ActivateBestChain (Matt Corallo)
962f7f0 Call ActivateBestChain without cs_main/with most_recent_block (Matt Corallo)
0df777d Use a temp pindex to avoid a const_cast in ProcessNewBlockHeaders (Matt Corallo)
c1ae4fc Avoid holding cs_most_recent_block while calling ReadBlockFromDisk (Matt Corallo)
9eb67f5 Ensure we meet the BIP 152 old-relay-types response requirements (Matt Corallo)
5749a85 Cache most-recently-connected compact block (Matt Corallo)
9eaec08 Cache most-recently-announced block's shared_ptr (Matt Corallo)
c802092 Relay compact block messages prior to full block connection (Matt Corallo)
6987219 Add a CValidationInterface::NewPoWValidBlock callback (Matt Corallo)
180586f Call AcceptBlock with the block's shared_ptr instead of CBlock& (Matt Corallo)
8baaba6 [qa] Avoid race in preciousblock test. (Matt Corallo)
9a0b2f4 [qa] Make compact blocks test construction using fetch methods (Matt Corallo)
8017547 Make CBlockIndex*es in net_processing const (Matt Corallo)

* Merge #9486: Make peer=%d log prints consistent

e6111b2 Make peer id logging consistent ("peer=%d" instead of "peer %d") (Matt Corallo)

* Merge #9400: Set peers as HB peers upon full block validation

d4781ac Set peers as HB peers upon full block validation (Gregory Sanders)

* Merge #9499: Use recent-rejects, orphans, and recently-replaced txn for compact-block-reconstruction

c594580 Add braces around AddToCompactExtraTransactions (Matt Corallo)
1ccfe9b Clarify comment about mempool/extra conflicts (Matt Corallo)
fac4c78 Make PartiallyDownloadedBlock::InitData's second param const (Matt Corallo)
b55b416 Add extra_count lower bound to compact reconstruction debug print (Matt Corallo)
863edb4 Consider all (<100k memusage) txn for compact-block-extra-txn cache (Matt Corallo)
7f8c8ca Consider all orphan txn for compact-block-extra-txn cache (Matt Corallo)
93380c5 Use replaced transactions in compact block reconstruction (Matt Corallo)
1531652 Keep shared_ptrs to recently-replaced txn for compact blocks (Matt Corallo)
edded80 Make ATMP optionally return the CTransactionRefs it replaced (Matt Corallo)
c735540 Move ORPHAN constants from validation.h to net_processing.h (Matt Corallo)

* Merge #9587: Do not shadow local variable named `tx`.

44f2baa Do not shadow local variable named `tx`. (Pavel Janík)

* Merge #9510: [trivial] Fix typos in comments

cc16d99 [trivial] Fix typos in comments (practicalswift)

* Merge #9604: [Trivial] add comment about setting peer as HB peer.

dd5b011 [Trivial] add comment about setting peer as HB peer. (John Newbery)

* Fix using of AcceptToMemoryPool in PrivateSend code

* add `override`

* fSupportsDesiredCmpctVersion

* bring back tx ressurection in DisconnectTip

* Fix delayed headers

* Remove unused CConnman::FindNode overload

* Fix typos and comments

* Fix minor code differences

* Don't use rejection cache for corrupted transactions

Partly based on https://github.com/bitcoin/bitcoin/pull/8525

* Backport missed cs_main locking changes

Missed from 58a215ce8c

* Backport missed comments and mapBlockSource.emplace call

Missed from two commits:
88c35491ab
7c98ce584e

* Add CheckPeerHeaders() helper and check in (nCount == 0) too
2018-04-11 14:06:01 +03:00
..
test_framework Backport compact blocks functionality from bitcoin (#1966) 2018-04-11 14:06:01 +03:00
.gitignore Python-based regression tests 2014-02-28 15:24:31 -05:00
abandonconflict.py Merge #8531: [qa] abandonconflict: Use assert_equal 2018-01-08 18:04:55 +01:00
addressindex.py Python 3 fixes/porting in rpc tests 2017-12-21 20:34:07 +01:00
assumevalid.py Add assumevalid testcase 2018-01-21 12:48:33 +01:00
bip9-softforks.py Merge #7948: RPC: augment getblockchaininfo bip9_softforks data 2018-01-13 13:44:37 +01:00
bip65-cltv-p2p.py Merge #8391: Consensus: Remove ISM 2018-01-20 09:22:40 +01:00
bip65-cltv.py Merge #8391: Consensus: Remove ISM 2018-01-20 09:22:40 +01:00
bip68-112-113-p2p.py Merge #7562: Bump transaction version default to 2 2018-01-20 09:22:38 +01:00
bip68-sequence.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
bipdersig-p2p.py Merge #8391: Consensus: Remove ISM 2018-01-20 09:22:40 +01:00
bipdersig.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
blockchain.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
create_cache.py Merge #8713: [qa] create_cache: Delete temp dir when done 2018-01-11 13:19:32 +01:00
decodescript.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
disablewallet.py Python 3 fixes/porting in rpc tests 2017-12-21 20:34:07 +01:00
forknotify.py Merge #9532: Remove unused variables 2018-01-23 09:24:27 +01:00
fundrawtransaction-hd.py Merge #9824: qa: Check return code when stopping nodes 2018-01-26 12:59:29 +01:00
fundrawtransaction.py Fix rpc tests 2018-01-26 12:59:29 +01:00
getblocktemplate_longpoll.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
getblocktemplate_proposals.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
getchaintips.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
httpbasics.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
import-rescan.py Fix import-rescan.py and add workaround for pruning mode 2018-02-01 11:13:01 +01:00
importmulti.py Merge #9108: Use importmulti timestamp when importing watch only keys (on top of #9682) 2018-02-01 11:13:01 +01:00
importprunedfunds.py Merge #8581: [wallet] rpc: Drop misleading option 2018-01-09 14:04:20 +01:00
invalidateblock.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
invalidblockrequest.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
invalidtxrequest.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
keypool-hd.py Introduce redirect_stderr argument to start_node 2017-12-21 20:36:54 +01:00
keypool.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
listsinceblock.py Fix listsinceblock.py 2018-01-21 14:14:34 +01:00
listtransactions.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
maxblocksinflight.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
maxuploadtarget.py Merge #9274: [qa] Use cached utxo set to fix performance regression 2018-01-17 17:31:12 +01:00
mempool_limit.py Merge #9274: [qa] Use cached utxo set to fix performance regression 2018-01-17 17:31:12 +01:00
mempool_packages.py Merge #10157: [0.14] Fix the mempool_packages.py test 2018-01-26 12:59:29 +01:00
mempool_reorg.py Merge #7562: Bump transaction version default to 2 2018-01-20 09:22:38 +01:00
mempool_resurrect_test.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
mempool_spendcoinbase.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
merkle_blocks.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
multi_rpc.py Merge #9233: Fix some typos 2018-01-17 17:27:24 +01:00
nodehandling.py Merge #9508: Remove unused Python imports 2018-01-21 12:48:33 +01:00
nulldummy.py Remove SegWit related tests/code from nulldummy.py 2018-01-30 20:18:17 +01:00
p2p-acceptblock.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
p2p-compactblocks.py Backport compact blocks functionality from bitcoin (#1966) 2018-04-11 14:06:01 +03:00
p2p-feefilter.py Merge #9607: Remove redundant semicolons in Python code 2018-01-21 12:48:33 +01:00
p2p-fullblocktest.py Merge #9765: Harden against mistakes handling invalid blocks 2018-02-08 11:18:48 +01:00
p2p-leaktests.py Merge #9720: net: fix banning and disallow sending messages before receiving verack 2018-01-23 09:24:28 +01:00
p2p-mempool.py Merge #9508: Remove unused Python imports 2018-01-21 12:48:33 +01:00
p2p-timeouts.py Merge #9715: Disconnect peers which we do not receive VERACKs from within 60 sec 2018-01-23 09:24:28 +01:00
p2p-versionbits-warning.py Merge #8860: [qa] util: Move wait_bitcoinds() into stop_nodes() 2018-01-12 09:57:56 +01:00
preciousblock.py [qa] Avoid race in preciousblock test. 2018-02-08 11:06:22 +01:00
prioritise_transaction.py Fix rpc tests 2018-01-26 12:59:29 +01:00
proxy_test.py Merge #9151: [qa] proxy_test: Calculate hardcoded port numbers 2018-01-15 06:14:16 +01:00
pruning.py Merge #9820: Fix pruning test broken by 2 hour manual prune window 2018-01-26 12:59:29 +01:00
rawtransactions.py Fix rpc tests 2018-01-15 08:26:15 +01:00
README.md test: remove necessity to call create_callback_map 2015-12-07 12:45:14 +01:00
receivedby.py Merge #9532: Remove unused variables 2018-01-23 09:24:27 +01:00
reindex.py Merge #8860: [qa] util: Move wait_bitcoinds() into stop_nodes() 2018-01-12 09:57:56 +01:00
replace-by-fee.py Merge #9532: Remove unused variables 2018-01-23 09:24:27 +01:00
rest.py Merge #8638: rest.cpp: change HTTP_INTERNAL_SERVER_ERROR to HTTP_BAD_REQUEST 2018-01-09 14:16:38 +01:00
rpcbind_test.py Merge #9824: qa: Check return code when stopping nodes 2018-01-26 12:59:29 +01:00
rpcnamedargs.py Merge #9707: Fix RPC failure testing 2018-01-23 09:24:28 +01:00
sendheaders.py [qa] Fix race condition in sendheaders.py 2018-02-08 10:40:51 +01:00
signmessages.py Dashify addresses/keys in signmessages.py RPC test 2017-12-21 20:37:17 +01:00
signrawtransactions.py Merge #9650: Better handle invalid parameters to signrawtransaction 2018-02-07 13:11:08 +01:00
smartfees.py Merge #9276: Some minor testing cleanups 2018-01-17 17:31:12 +01:00
spentindex.py Fix rpc tests 2018-01-15 08:26:15 +01:00
timestampindex.py Python 3 fixes/porting in rpc tests 2017-12-21 20:34:07 +01:00
txindex.py Python 3 fixes/porting in rpc tests 2017-12-21 20:34:07 +01:00
txn_clone.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
txn_doublespend.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
wallet-accounts.py Fix wallet-accounts.py tests 2018-01-09 17:45:28 +01:00
wallet-dump.py Remove "TODO: fix off-by-one" 2018-02-01 11:13:01 +01:00
wallet-hd.py Introduce redirect_stderr argument to start_node 2017-12-21 20:36:54 +01:00
wallet.py Few cleanups after backporting (#1903) 2018-02-08 08:43:50 +03:00
walletbackup.py Merge #8724: [qa] walletbackup: Sync blocks inside the loop 2018-01-11 13:19:32 +01:00
zapwallettxes.py Merge #8056: [qa] Remove hardcoded "4 nodes" from test_framework 2017-12-21 18:50:13 +01:00
zmq_test.py Merge #9508: Remove unused Python imports 2018-01-21 12:48:33 +01:00

Regression tests

test_framework/authproxy.py

Taken from the python-bitcoinrpc repository.

test_framework/test_framework.py

Base class for new regression tests.

test_framework/util.py

Generally useful functions.

test_framework/mininode.py

Basic code to support p2p connectivity to a bitcoind.

test_framework/comptool.py

Framework for comparison-tool style, p2p tests.

test_framework/script.py

Utilities for manipulating transaction scripts (originally from python-bitcoinlib)

test_framework/blockstore.py

Implements disk-backed block and tx storage.

test_framework/key.py

Wrapper around OpenSSL EC_Key (originally from python-bitcoinlib)

test_framework/bignum.py

Helpers for script.py

test_framework/blocktools.py

Helper functions for creating blocks and transactions.

P2P test design notes

Mininode

  • mininode.py contains all the definitions for objects that pass over the network (CBlock, CTransaction, etc, along with the network-level wrappers for them, msg_block, msg_tx, etc).

  • P2P tests have two threads. One thread handles all network communication with the bitcoind(s) being tested (using python's asyncore package); the other implements the test logic.

  • NodeConn is the class used to connect to a bitcoind. If you implement a callback class that derives from NodeConnCB and pass that to the NodeConn object, your code will receive the appropriate callbacks when events of interest arrive.

  • You can pass the same handler to multiple NodeConn's if you like, or pass different ones to each -- whatever makes the most sense for your test.

  • Call NetworkThread.start() after all NodeConn objects are created to start the networking thread. (Continue with the test logic in your existing thread.)

  • RPC calls are available in p2p tests.

  • Can be used to write free-form tests, where specific p2p-protocol behavior is tested. Examples: p2p-accept-block.py, maxblocksinflight.py.

Comptool

  • Testing framework for writing tests that compare the block/tx acceptance behavior of a bitcoind against 1 or more other bitcoind instances, or against known outcomes, or both.

  • Set the num_nodes variable (defined in ComparisonTestFramework) to start up 1 or more nodes. If using 1 node, then --testbinary can be used as a command line option to change the bitcoind binary used by the test. If using 2 or more nodes, then --refbinary can be optionally used to change the bitcoind that will be used on nodes 2 and up.

  • Implement a (generator) function called get_tests() which yields TestInstances. Each TestInstance consists of:

    • a list of [object, outcome, hash] entries
      • object is a CBlock, CTransaction, or CBlockHeader. CBlock's and CTransaction's are tested for acceptance. CBlockHeaders can be used so that the test runner can deliver complete headers-chains when requested from the bitcoind, to allow writing tests where blocks can be delivered out of order but still processed by headers-first bitcoind's.
      • outcome is True, False, or None. If True or False, the tip is compared with the expected tip -- either the block passed in, or the hash specified as the optional 3rd entry. If None is specified, then the test will compare all the bitcoind's being tested to see if they all agree on what the best tip is.
      • hash is the block hash of the tip to compare against. Optional to specify; if left out then the hash of the block passed in will be used as the expected tip. This allows for specifying an expected tip while testing the handling of either invalid blocks or blocks delivered out of order, which complete a longer chain.
    • sync_every_block: True/False. If False, then all blocks are inv'ed together, and the test runner waits until the node receives the last one, and tests only the last block for tip acceptance using the outcome and specified tip. If True, then each block is tested in sequence and synced (this is slower when processing many blocks).
    • sync_every_transaction: True/False. Analogous to sync_every_block, except if the outcome on the last tx is "None", then the contents of the entire mempool are compared across all bitcoind connections. If True or False, then only the last tx's acceptance is tested against the given outcome.
  • For examples of tests written in this framework, see invalidblockrequest.py and p2p-fullblocktest.py.