zcashd/qa/rpc-tests
therealyingtong da15ada52e Test getrawtransaction in wallet_orchard.py 2022-07-01 08:50:34 -04:00
..
golden
test_framework scripted-diff: Add 2020-2022 copyright headers for files added/modified in 2020 2022-05-11 17:32:39 -06:00
.gitignore
README.md [qa] Split README.md to /qa and /qa/rpc-tests 2020-11-21 02:33:27 +00:00
addressindex.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
bip65-cltv-p2p.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
bipdersig-p2p.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
blockchain.py scripted-diff: Add 2018-2022 copyright headers for files added/modified in 2018 2022-05-11 17:28:03 -06:00
coinbase_funding_streams.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
create_cache.py scripted-diff: Add 2020-2022 copyright headers for files added/modified in 2020 2022-05-11 17:32:39 -06:00
decodescript.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
disablewallet.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
feature_logging.py scripted-diff: Add 2020-2022 copyright headers for files added/modified in 2020 2022-05-11 17:32:39 -06:00
feature_walletfile.py scripted-diff: Add 2020-2022 copyright headers for files added/modified in 2020 2022-05-11 17:32:39 -06:00
feature_zip221.py test: Cleanups to ZIP 221 Python test code 2021-06-20 21:25:59 +01:00
feature_zip239.py Add a CLI flag to preferentially send V4 tx. 2022-05-26 07:26:38 -06:00
feature_zip244_blockcommitments.py Fix bugs in testnet Orchard circuit 2021-09-28 22:56:37 +01:00
finalsaplingroot.py Make Orchard `finalState` serialization format match Sapling. 2022-04-08 19:48:40 -06:00
forknotify.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
framework.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
fundrawtransaction.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
getblocktemplate.py Add tests to check auth data commitments committing to Orchard actions. 2022-05-09 21:01:11 -06:00
getblocktemplate_longpoll.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
getblocktemplate_proposals.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
getchaintips.py scripted-diff: Add 2018-2022 copyright headers for files added/modified in 2018 2022-05-11 17:28:03 -06:00
getmininginfo.py [rpc] mining: Omit uninitialized currentblockweight, currentblocktx 2021-12-17 09:35:30 -07:00
getrawtransaction_insight.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
hardforkdetection.py python: Explicitly set encoding to utf8 when opening text files 2020-11-09 23:06:21 +00:00
httpbasics.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
invalidateblock.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
invalidblockrequest.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
invalidtxrequest.py All implementations of ComparisonTestFramework were overriding num_nodes 2022-02-01 10:27:16 -07:00
key_import_export.py test: Adjust some Zcash RPC tests to work with parallel runner 2020-11-21 03:03:58 +00:00
keypool.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
listtransactions.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
maxblocksinflight.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
maxuploadtarget.py Allow rpc python tests to be run standalone 2022-04-26 15:06:31 -06:00
mempool_limit.py scripted-diff: Add 2019-2022 copyright headers for files added/modified in 2019 2022-05-11 17:29:59 -06:00
mempool_nu_activation.py Fix bugs in testnet Orchard circuit 2021-09-28 22:56:37 +01:00
mempool_reorg.py scripted-diff: Add 2019-2022 copyright headers for files added/modified in 2019 2022-05-11 17:29:59 -06:00
mempool_resurrect_test.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
mempool_spendcoinbase.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
mempool_tx_expiry.py Select Orchard anchors at `-orchardanchorconfirmations` depth. 2022-05-04 14:16:43 -06:00
mergetoaddress_helper.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
mergetoaddress_mixednotes.py Fix RPC tests that depend upon -anchorconfirmations=1 2022-05-04 18:00:34 -06:00
mergetoaddress_sapling.py Fix RPC tests that depend upon -anchorconfirmations=1 2022-05-04 18:00:34 -06:00
mergetoaddress_sprout.py Fix RPC tests that depend upon -anchorconfirmations=1 2022-05-04 18:00:34 -06:00
merkle_blocks.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
mining_shielded_coinbase.py Merge remote-tracking branch 'upstream/master' into nu5-consensus 2022-03-28 10:13:51 -06:00
multi_rpc.py scripted-diff: Add 2019-2022 copyright headers for files added/modified in 2019 2022-05-11 17:29:59 -06:00
nodehandling.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
nuparams.py qa: Remove hard-coded consensus branch IDs from RPC tests 2022-03-23 20:28:31 +00:00
orchard_reorg.py Merge remote-tracking branch 'upstream/master' into nu5-consensus 2022-03-28 10:13:51 -06:00
p2p-acceptblock.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
p2p-fullblocktest.py scripted-diff: Add 2020-2022 copyright headers for files added/modified in 2020 2022-05-11 17:32:39 -06:00
p2p_node_bloom.py
p2p_nu_peer_management.py
p2p_txexpiringsoon.py test: Fix race condition in p2p_txexpiringsoon 2021-08-09 17:43:48 +01:00
p2p_txexpiry_dos.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
post_heartwood_rollback.py [qa] Remove hardcoded "4 nodes" from test_framework 2020-11-21 02:34:47 +00:00
prioritisetransaction.py qa: Bump `sync_mempool` timeout for `prioritisetransaction.py` 2021-08-13 02:12:35 +01:00
proxy_test.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
pruning.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
rawtransactions.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
receivedby.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
regtest_signrawtransaction.py Select Orchard anchors at `-orchardanchorconfirmations` depth. 2022-05-04 14:16:43 -06:00
reindex.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
remove_sprout_shielding.py Fix RPC tests that depend upon -anchorconfirmations=1 2022-05-04 18:00:34 -06:00
reorg_limit.py test: Adjust some Zcash RPC tests to work with parallel runner 2020-11-21 03:03:58 +00:00
rest.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
rewind_index.py Tests: add timeout to sync_blocks() and sync_mempools() 2020-11-21 02:34:47 +00:00
rpcbind_test.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
sapling_rewind_check.py test: Adjust some Zcash RPC tests to work with parallel runner 2020-11-21 03:03:58 +00:00
shorter_block_times.py test: Wait for transaction propagation in shorter_block_times RPC test 2021-08-05 20:54:47 +01:00
signrawtransaction_offline.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
signrawtransactions.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
smartfees.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00
spentindex.py
sprout_sapling_migration.py qa: Fix sprout_sapling_migration RPC test to handle wallet RPC change 2022-06-01 13:51:26 +00:00
threeofthreerestore.py Fix missing handling for imported transparent multisig addresses. 2022-05-06 13:29:05 -06:00
timestampindex.py
turnstile.py Add logging to the miner to provide more detail on tx selection. 2022-04-05 20:47:37 -06:00
tx_expiry_helper.py ProcessGetData: Respond to MSG_WTX requests 2021-09-10 21:46:05 +01:00
txn_doublespend.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
upgrade_golden.py Fix typos 2021-11-14 16:27:09 +02:00
wallet.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
wallet_1941.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_accounts.py Fix error in z_listaccounts help text. 2022-04-08 13:06:41 -06:00
wallet_addresses.py Add a test verifying the default addr is added when importing a Sapling key. 2022-03-28 19:47:19 -06:00
wallet_anchorfork.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
wallet_broadcast.py Require backup of the emergency recovery phrase. 2021-10-29 13:38:36 -06:00
wallet_changeaddresses.py Use transaction builder for asyncrpcoperation_sendmany. 2022-01-11 13:28:34 -07:00
wallet_changeindicator.py test: Use default shielded address in RPC tests where the type is irrelevant 2020-11-11 22:43:26 +00:00
wallet_db_flush.py fix pyflakes CI errors 2020-07-02 14:32:48 -06:00
wallet_deprecation.py Remove `-allowdeprecated=all` 2022-05-03 20:32:10 -06:00
wallet_doublespend.py Apply suggestions from code review 2022-03-28 19:46:21 -06:00
wallet_import_export.py Merge remote-tracking branch 'upstream/master' into feature/wallet_orchard 2021-11-23 18:38:07 -07:00
wallet_isfromme.py wallet: Check spent shielded notes in CWalletTx::IsFromMe 2021-09-28 02:51:04 +01:00
wallet_listnotes.py Add account ID to z_listunspent results. 2022-04-01 10:02:13 -06:00
wallet_listreceived.py Select Orchard anchors at `-orchardanchorconfirmations` depth. 2022-05-04 14:16:43 -06:00
wallet_nullifiers.py Select Orchard anchors at `-orchardanchorconfirmations` depth. 2022-05-04 14:16:43 -06:00
wallet_orchard.py Test getrawtransaction in wallet_orchard.py 2022-07-01 08:50:34 -04:00
wallet_orchard_change.py Add 'AllowRevealedAmounts' in tests where it is now necessary. 2022-04-07 08:47:47 -06:00
wallet_orchard_init.py Update test to verify rewind behavior. 2022-04-04 13:05:42 -06:00
wallet_orchard_persistence.py Use default anchor confirmations for minconf in z_mergetoaddress. 2022-05-06 22:15:20 -06:00
wallet_overwintertx.py Use transaction builder for asyncrpcoperation_sendmany. 2022-01-11 13:28:34 -07:00
wallet_parsing_amounts.py split wallet.py tests 2020-12-29 14:42:46 -03:00
wallet_persistence.py Fix typos 2021-11-14 16:27:09 +02:00
wallet_sapling.py Improve consistency of RPC parameter and result attribute naming. 2022-03-25 10:44:18 -06:00
wallet_sendmany_any_taddr.py Select Orchard anchors at `-orchardanchorconfirmations` depth. 2022-05-04 14:16:43 -06:00
wallet_shieldcoinbase.py Remove the fExperimentalOrchardWallet flag and related logic 2022-03-25 21:46:09 -07:00
wallet_shieldcoinbase_sapling.py allow UA as z_shieldcoinbase destination 2022-02-03 08:31:26 -07:00
wallet_shieldcoinbase_sprout.py allow UA as z_shieldcoinbase destination 2022-02-03 08:31:26 -07:00
wallet_shieldcoinbase_ua_nu5.py Improve consistency of RPC parameter and result attribute naming. 2022-03-25 10:44:18 -06:00
wallet_shieldcoinbase_ua_sapling.py Rename unifiedaddress->address in z_getaddressforaccount results 2022-03-25 08:29:56 -06:00
wallet_shieldingcoinbase.py Select Orchard anchors at `-orchardanchorconfirmations` depth. 2022-05-04 14:16:43 -06:00
wallet_treestate.py Select Orchard anchors at `-orchardanchorconfirmations` depth. 2022-05-04 14:16:43 -06:00
wallet_unified_change.py Use DEFAULT_FEE consistently in wallet_unified_change test 2022-04-07 08:57:48 -06:00
wallet_z_sendmany.py Use default anchor confirmations for minconf in z_mergetoaddress. 2022-05-06 22:15:20 -06:00
wallet_zero_value.py Fix pyflakes complaints 2021-01-14 07:34:40 -07:00
walletbackup.py Update walletbackup.py 2022-06-28 17:10:53 -07:00
zapwallettxes.py scripted-diff: Add 2016-2022 copyright headers for files added/modified in 2016 2022-05-11 17:23:09 -06:00
zcjoinsplit.py Remove `-allowdeprecated=all` 2022-05-03 20:32:10 -06:00
zcjoinsplitdoublespend.py Remove `-allowdeprecated=all` 2022-05-03 20:32:10 -06:00
zkey_import_export.py Reduce the default fee for z_* operations, and the "low fee penalty" threshold for mempool limiting, to 1000 zatoshis. 2020-12-18 12:37:03 -07:00
zmq_test.py scripted-diff: Add 2017-2022 copyright headers for files added/modified in 2017 2022-05-11 17:25:51 -06:00

README.md

Regression tests

test_framework/test_framework.py

Base class for RPC 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. NOTE: be sure to call self.create_callback_map() in your derived classes' __init__ function, so that the correct mappings are set up between p2p messages and your callback functions.

  • 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.