![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
Functions | |
def | enable_mocktime () |
def | disable_mocktime () |
def | get_mocktime () |
def | enable_coverage (dirname) |
def | get_rpc_proxy (url, node_number, timeout=None) |
def | get_mnsync_status (node) |
def | wait_to_sync (node) |
def | p2p_port (n) |
def | rpc_port (n) |
def | check_json_precision () |
def | count_bytes (hex_string) |
def | bytes_to_hex_str (byte_str) |
def | hex_str_to_bytes (hex_str) |
def | str_to_b64str (string) |
def | sync_blocks (rpc_connections, wait=1) |
def | sync_mempools (rpc_connections, wait=1) |
def | sync_masternodes (rpc_connections) |
def | initialize_datadir (dirname, n) |
def | rpc_url (i, rpchost=None) |
def | wait_for_bitcoind_start (process, url, i) |
def | initialize_chain (test_dir) |
def | initialize_chain_clean (test_dir, num_nodes) |
def | _rpchost_to_args (rpchost) |
def | start_node (i, dirname, extra_args=None, rpchost=None, timewait=None, binary=None) |
def | start_nodes (num_nodes, dirname, extra_args=None, rpchost=None, binary=None) |
def | log_filename (dirname, n_node, logname) |
def | stop_node (node, i) |
def | stop_nodes (nodes) |
def | set_node_times (nodes, t) |
def | wait_bitcoinds () |
def | connect_nodes (from_connection, node_num) |
def | connect_nodes_bi (nodes, a, b) |
def | find_output (node, txid, amount) |
def | gather_inputs (from_node, amount_needed, confirmations_required=1) |
def | make_change (from_node, amount_in, amount_out, fee) |
def | send_zeropri_transaction (from_node, to_node, amount, fee) |
def | random_zeropri_transaction (nodes, amount, min_fee, fee_increment, fee_variants) |
def | random_transaction (nodes, amount, min_fee, fee_increment, fee_variants) |
def | assert_equal (thing1, thing2) |
def | assert_greater_than (thing1, thing2) |
def | assert_raises (exc, fun, args, kwds) |
def | assert_is_hex_string (string) |
def | assert_is_hash_string (string, length=64) |
def | assert_array_result (object_array, to_match, expected, should_not_find=False) |
def | satoshi_round (amount) |
def | create_confirmed_utxos (fee, node, count) |
def | gen_return_txouts () |
def | create_tx (node, coinbase, to_address, amount) |
def | create_lots_of_big_transactions (node, txouts, utxos, fee) |
def | get_bip9_status (node, key) |
Variables | |
COVERAGE_DIR = None | |
int | MOCKTIME = 0 |
dictionary | bitcoind_processes = {} |
|
private |
def test_framework.util.assert_array_result | ( | object_array, | |
to_match, | |||
expected, | |||
should_not_find = False |
|||
) |
Pass in array of JSON objects, a dictionary with key/value pairs to match against, and another dictionary with expected key/value pairs. If the should_not_find flag is true, to_match should not be found in object_array
Definition at line 496 of file util.py.
Referenced by listtransactions.ListTransactionsTest.run_rbf_opt_in_test(), listtransactions.ListTransactionsTest.run_test(), receivedby.ReceivedByTest.run_test(), and wallet.WalletTest.run_test().
def test_framework.util.assert_equal | ( | thing1, | |
thing2 | |||
) |
Definition at line 461 of file util.py.
Referenced by blockchain.BlockchainTest._test_getblockheader(), blockchain.BlockchainTest._test_gettxoutsetinfo(), test_framework.util.assert_array_result(), smartfees.check_estimates(), test_framework.util.create_tx(), decodescript.DecodeScriptTest.decoderawtransaction_asm_sighashtype(), decodescript.DecodeScriptTest.decodescript_script_pub_key(), decodescript.DecodeScriptTest.decodescript_script_sig(), proxy_test.ProxyTest.node_test(), reindex.ReindexTest.reindex(), rpcbind_test.run_bind_test(), listtransactions.ListTransactionsTest.run_rbf_opt_in_test(), keypool-hd.KeyPoolTest.run_test(), keypool.KeyPoolTest.run_test(), txn_clone.TxnMallTest.run_test(), nodehandling.NodeHandlingTest.run_test(), txn_doublespend.TxnMallTest.run_test(), mempool_resurrect_test.MempoolCoinbaseTest.run_test(), zapwallettxes.ZapWalletTXesTest.run_test(), wallet-hd.WalletHDTest.run_test(), httpbasics.HTTPBasicsTest.run_test(), fundrawtransaction-hd.RawTransactionsTest.run_test(), fundrawtransaction.RawTransactionsTest.run_test(), mempool_reorg.MempoolCoinbaseTest.run_test(), mempool_spendcoinbase.MempoolSpendCoinbaseTest.run_test(), prioritise_transaction.PrioritiseTransactionTest.run_test(), merkle_blocks.MerkleBlockTest.run_test(), test_framework.test_framework.BitcoinTestFramework.run_test(), wallet.WalletTest.run_test(), multi_rpc.HTTPBasicsTest.run_test(), rawtransactions.RawTransactionsTest.run_test(), timestampindex.TimestampIndexTest.run_test(), txindex.TxIndexTest.run_test(), spentindex.SpentIndexTest.run_test(), addressindex.AddressIndexTest.run_test(), mempool_packages.MempoolPackagesTest.run_test(), zmq_test.ZMQTest.run_test(), rest.RESTTest.run_test(), walletbackup.WalletBackupTest.run_test(), maxuploadtarget.MaxUploadTest.run_test(), p2p-acceptblock.AcceptBlockTest.run_test(), proxy_test.ProxyTest.run_test(), signrawtransactions.SignRawTransactionsTest.script_verification_error_test(), signrawtransactions.SignRawTransactionsTest.successful_signing_test(), bip68-sequence.BIP68Test.test_bip68_not_consensus(), bip68-sequence.BIP68Test.test_disable_flag(), replace-by-fee.ReplaceByFeeTest.test_doublespend_chain(), replace-by-fee.ReplaceByFeeTest.test_doublespend_tree(), replace-by-fee.ReplaceByFeeTest.test_new_unconfirmed_inputs(), replace-by-fee.ReplaceByFeeTest.test_opt_in(), replace-by-fee.ReplaceByFeeTest.test_prioritised_transactions(), replace-by-fee.ReplaceByFeeTest.test_replacement_feeperkb(), bip68-sequence.BIP68Test.test_sequence_lock_confirmed_inputs(), bip68-sequence.BIP68Test.test_sequence_lock_unconfirmed_inputs(), replace-by-fee.ReplaceByFeeTest.test_simple_doublespend(), replace-by-fee.ReplaceByFeeTest.test_spends_of_conflicting_outputs(), and replace-by-fee.ReplaceByFeeTest.test_too_many_replacements().
def test_framework.util.assert_greater_than | ( | thing1, | |
thing2 | |||
) |
Definition at line 465 of file util.py.
Referenced by fundrawtransaction-hd.RawTransactionsTest.run_test(), fundrawtransaction.RawTransactionsTest.run_test(), and rest.RESTTest.run_test().
def test_framework.util.assert_is_hash_string | ( | string, | |
length = 64 |
|||
) |
Definition at line 486 of file util.py.
Referenced by blockchain.BlockchainTest._test_getblockheader().
def test_framework.util.assert_is_hex_string | ( | string | ) |
Definition at line 479 of file util.py.
Referenced by blockchain.BlockchainTest._test_getblockheader().
def test_framework.util.assert_raises | ( | exc, | |
fun, | |||
args, | |||
kwds | |||
) |
Definition at line 469 of file util.py.
Referenced by blockchain.BlockchainTest._test_getblockheader(), zapwallettxes.ZapWalletTXesTest.run_test(), mempool_reorg.MempoolCoinbaseTest.run_test(), mempool_spendcoinbase.MempoolSpendCoinbaseTest.run_test(), merkle_blocks.MerkleBlockTest.run_test(), wallet.WalletTest.run_test(), and getblocktemplate_proposals.GetBlockTemplateProposalTest.run_test().
def test_framework.util.bytes_to_hex_str | ( | byte_str | ) |
def test_framework.util.check_json_precision | ( | ) |
def test_framework.util.connect_nodes | ( | from_connection, | |
node_num | |||
) |
Definition at line 343 of file util.py.
Referenced by test_framework.util.connect_nodes_bi(), pruning.PruneTest.create_chain_with_staleblocks(), pruning.PruneTest.reorg_test(), abandonconflict.AbandonConflictTest.run_test(), txn_clone.TxnMallTest.run_test(), txn_doublespend.TxnMallTest.run_test(), and walletbackup.WalletBackupTest.start_three().
def test_framework.util.connect_nodes_bi | ( | nodes, | |
a, | |||
b | |||
) |
Definition at line 351 of file util.py.
Referenced by nodehandling.NodeHandlingTest.run_test(), wallet-hd.WalletHDTest.run_test(), fundrawtransaction-hd.RawTransactionsTest.run_test(), fundrawtransaction.RawTransactionsTest.run_test(), invalidateblock.InvalidateTest.run_test(), and wallet.WalletTest.run_test().
def test_framework.util.count_bytes | ( | hex_string | ) |
Definition at line 105 of file util.py.
Referenced by wallet.WalletTest.run_test().
def test_framework.util.create_confirmed_utxos | ( | fee, | |
node, | |||
count | |||
) |
Definition at line 530 of file util.py.
Referenced by mempool_limit.MempoolLimitTest.run_test(), and prioritise_transaction.PrioritiseTransactionTest.run_test().
def test_framework.util.create_lots_of_big_transactions | ( | node, | |
txouts, | |||
utxos, | |||
fee | |||
) |
Definition at line 587 of file util.py.
Referenced by mempool_limit.MempoolLimitTest.run_test(), and prioritise_transaction.PrioritiseTransactionTest.run_test().
def test_framework.util.create_tx | ( | node, | |
coinbase, | |||
to_address, | |||
amount | |||
) |
def test_framework.util.disable_mocktime | ( | ) |
Definition at line 45 of file util.py.
Referenced by test_framework.util.initialize_chain().
def test_framework.util.enable_coverage | ( | dirname | ) |
Maintain a log of which RPC calls are made during testing.
Definition at line 52 of file util.py.
Referenced by test_framework.test_framework.BitcoinTestFramework.main().
def test_framework.util.enable_mocktime | ( | ) |
Definition at line 38 of file util.py.
Referenced by test_framework.util.initialize_chain(), listtransactions.ListTransactionsTest.setup_nodes(), and receivedby.ReceivedByTest.setup_nodes().
def test_framework.util.find_output | ( | node, | |
txid, | |||
amount | |||
) |
Return index to output of txid with value amount Raises exception if there is none.
Definition at line 355 of file util.py.
Referenced by txn_doublespend.TxnMallTest.run_test(), and test_framework.util.send_zeropri_transaction().
def test_framework.util.gather_inputs | ( | from_node, | |
amount_needed, | |||
confirmations_required = 1 |
|||
) |
Return a random set of unspent txouts that are enough to pay amount_needed
Definition at line 367 of file util.py.
Referenced by test_framework.util.random_transaction(), and test_framework.util.send_zeropri_transaction().
def test_framework.util.get_bip9_status | ( | node, | |
key | |||
) |
Definition at line 606 of file util.py.
Referenced by bip68-sequence.BIP68Test.activateCSV(), and bip68-sequence.BIP68Test.test_bip68_not_consensus().
def test_framework.util.get_mnsync_status | ( | node | ) |
Definition at line 83 of file util.py.
Referenced by test_framework.util.wait_to_sync().
def test_framework.util.get_mocktime | ( | ) |
Definition at line 49 of file util.py.
Referenced by test_framework.util.initialize_chain(), and test_framework.util.start_node().
def test_framework.util.get_rpc_proxy | ( | url, | |
node_number, | |||
timeout = None |
|||
) |
Args: url (str): URL of the RPC server to call node_number (int): the node number (or id) that this calls to Kwargs: timeout (int): HTTP timeout in seconds Returns: AuthServiceProxy. convenience object for making RPC calls.
Definition at line 58 of file util.py.
Referenced by test_framework.util.initialize_chain(), rpcbind_test.run_allowip_test(), test_framework.util.start_node(), and test_framework.util.wait_for_bitcoind_start().
def test_framework.util.hex_str_to_bytes | ( | hex_str | ) |
Definition at line 111 of file util.py.
Referenced by bip9-softforks.BIP9SoftForksTest.create_transaction(), bip65-cltv-p2p.BIP65Test.create_transaction(), bipdersig-p2p.BIP66Test.create_transaction(), bip68-112-113-p2p.BIP68_112_113Test.create_transaction(), decodescript.DecodeScriptTest.decoderawtransaction_asm_sighashtype(), rest.RESTTest.run_test(), bip9-softforks.BIP9SoftForksTest.sign_transaction(), bip68-112-113-p2p.BIP68_112_113Test.sign_transaction(), and listtransactions.txFromHex().
def test_framework.util.initialize_chain | ( | test_dir | ) |
Create (or copy from cache) a 200-block-long chain and 4 wallets.
Definition at line 184 of file util.py.
Referenced by rpcbind_test.main(), multi_rpc.HTTPBasicsTest.setup_chain(), and blockchain.BlockchainTest.setup_chain().
def test_framework.util.initialize_chain_clean | ( | test_dir, | |
num_nodes | |||
) |
Create an empty blockchain and num_nodes wallets. Useful if a test case wants complete control over initialization.
Definition at line 252 of file util.py.
Referenced by fundrawtransaction-hd.RawTransactionsTest.setup_chain(), fundrawtransaction.RawTransactionsTest.setup_chain(), zapwallettxes.ZapWalletTXesTest.setup_chain(), signrawtransactions.SignRawTransactionsTest.setup_chain(), decodescript.DecodeScriptTest.setup_chain(), wallet-hd.WalletHDTest.setup_chain(), reindex.ReindexTest.setup_chain(), merkle_blocks.MerkleBlockTest.setup_chain(), invalidateblock.InvalidateTest.setup_chain(), disablewallet.DisableWalletTest.setup_chain(), rawtransactions.RawTransactionsTest.setup_chain(), timestampindex.TimestampIndexTest.setup_chain(), txindex.TxIndexTest.setup_chain(), addressindex.AddressIndexTest.setup_chain(), spentindex.SpentIndexTest.setup_chain(), prioritise_transaction.PrioritiseTransactionTest.setup_chain(), mempool_limit.MempoolLimitTest.setup_chain(), wallet.WalletTest.setup_chain(), pruning.PruneTest.setup_chain(), walletbackup.WalletBackupTest.setup_chain(), rest.RESTTest.setup_chain(), p2p-versionbits-warning.VersionBitsWarningTest.setup_chain(), keypool.KeyPoolTest.setup_chain(), maxblocksinflight.MaxBlocksInFlightTest.setup_chain(), maxuploadtarget.MaxUploadTest.setup_chain(), keypool-hd.KeyPoolTest.setup_chain(), p2p-acceptblock.AcceptBlockTest.setup_chain(), test_framework.test_framework.ComparisonTestFramework.setup_chain(), and sendheaders.SendHeadersTest.setup_chain().
def test_framework.util.initialize_datadir | ( | dirname, | |
n | |||
) |
Definition at line 148 of file util.py.
Referenced by test_framework.util.initialize_chain(), and test_framework.util.initialize_chain_clean().
def test_framework.util.log_filename | ( | dirname, | |
n_node, | |||
logname | |||
) |
Definition at line 320 of file util.py.
Referenced by test_framework.util.initialize_chain().
def test_framework.util.make_change | ( | from_node, | |
amount_in, | |||
amount_out, | |||
fee | |||
) |
Create change output(s), return them
Definition at line 384 of file util.py.
Referenced by test_framework.util.random_transaction(), and test_framework.util.send_zeropri_transaction().
def test_framework.util.p2p_port | ( | n | ) |
Definition at line 93 of file util.py.
Referenced by test_framework.comptool.TestManager.add_all_connections(), test_framework.util.connect_nodes(), test_framework.util.initialize_chain(), test_framework.util.initialize_datadir(), abandonconflict.AbandonConflictTest.run_test(), nodehandling.NodeHandlingTest.run_test(), maxblocksinflight.MaxBlocksInFlightTest.run_test(), p2p-versionbits-warning.VersionBitsWarningTest.run_test(), maxuploadtarget.MaxUploadTest.run_test(), and p2p-acceptblock.AcceptBlockTest.run_test().
def test_framework.util.random_transaction | ( | nodes, | |
amount, | |||
min_fee, | |||
fee_increment, | |||
fee_variants | |||
) |
Create a random transaction. Returns (txid, hex-encoded-transaction-data, fee)
Definition at line 442 of file util.py.
Referenced by getblocktemplate_longpoll.GetBlockTemplateLPTest.run_test().
def test_framework.util.random_zeropri_transaction | ( | nodes, | |
amount, | |||
min_fee, | |||
fee_increment, | |||
fee_variants | |||
) |
def test_framework.util.rpc_port | ( | n | ) |
Definition at line 95 of file util.py.
Referenced by test_framework.util.initialize_datadir(), test_framework.util.rpc_url(), and rpcbind_test.run_test().
def test_framework.util.rpc_url | ( | i, | |
rpchost = None |
|||
) |
Definition at line 161 of file util.py.
Referenced by test_framework.util.initialize_chain(), and test_framework.util.start_node().
def test_framework.util.satoshi_round | ( | amount | ) |
Definition at line 525 of file util.py.
Referenced by mempool_packages.MempoolPackagesTest.chain_transaction(), test_framework.util.create_confirmed_utxos(), test_framework.util.create_lots_of_big_transactions(), replace-by-fee.make_utxo(), mempool_packages.MempoolPackagesTest.run_test(), smartfees.small_txpuzzle_randfee(), smartfees.split_inputs(), and bip68-sequence.BIP68Test.test_disable_flag().
def test_framework.util.send_zeropri_transaction | ( | from_node, | |
to_node, | |||
amount, | |||
fee | |||
) |
Create&broadcast a zero-priority transaction. Returns (txid, hex-encoded-txdata) Ensures transaction is zero-priority by first creating a send-to-self, then using its output
Definition at line 401 of file util.py.
Referenced by test_framework.util.random_zeropri_transaction().
def test_framework.util.set_node_times | ( | nodes, | |
t | |||
) |
Definition at line 333 of file util.py.
Referenced by test_framework.util.initialize_chain().
def test_framework.util.start_node | ( | i, | |
dirname, | |||
extra_args = None , |
|||
rpchost = None , |
|||
timewait = None , |
|||
binary = None |
|||
) |
Start a dashd and return RPC connection to it
Definition at line 281 of file util.py.
Referenced by pruning.PruneTest.create_chain_with_staleblocks(), reindex.ReindexTest.reindex(), pruning.PruneTest.reorg_test(), keypool-hd.KeyPoolTest.run_test(), keypool.KeyPoolTest.run_test(), abandonconflict.AbandonConflictTest.run_test(), nodehandling.NodeHandlingTest.run_test(), zapwallettxes.ZapWalletTXesTest.run_test(), wallet-hd.WalletHDTest.run_test(), wallet.WalletTest.run_test(), p2p-versionbits-warning.VersionBitsWarningTest.run_test(), maxuploadtarget.MaxUploadTest.run_test(), test_framework.util.start_nodes(), and walletbackup.WalletBackupTest.start_three().
def test_framework.util.start_nodes | ( | num_nodes, | |
dirname, | |||
extra_args = None , |
|||
rpchost = None , |
|||
binary = None |
|||
) |
Start multiple dashds, return RPC connections to them
Definition at line 305 of file util.py.
Referenced by rpcbind_test.run_allowip_test(), rpcbind_test.run_bind_test(), fundrawtransaction-hd.RawTransactionsTest.run_test(), fundrawtransaction.RawTransactionsTest.run_test(), wallet.WalletTest.run_test(), listtransactions.ListTransactionsTest.setup_nodes(), httpbasics.HTTPBasicsTest.setup_nodes(), multi_rpc.HTTPBasicsTest.setup_nodes(), receivedby.ReceivedByTest.setup_nodes(), test_framework.test_framework.BitcoinTestFramework.setup_nodes(), and proxy_test.ProxyTest.setup_nodes().
def test_framework.util.stop_node | ( | node, | |
i | |||
) |
Definition at line 323 of file util.py.
Referenced by pruning.PruneTest.create_chain_with_staleblocks(), reindex.ReindexTest.reindex(), pruning.PruneTest.reorg_test(), abandonconflict.AbandonConflictTest.run_test(), nodehandling.NodeHandlingTest.run_test(), wallet-hd.WalletHDTest.run_test(), p2p-versionbits-warning.VersionBitsWarningTest.run_test(), maxuploadtarget.MaxUploadTest.run_test(), and walletbackup.WalletBackupTest.stop_three().
def test_framework.util.stop_nodes | ( | nodes | ) |
Definition at line 328 of file util.py.
Referenced by test_framework.util.initialize_chain(), test_framework.test_framework.BitcoinTestFramework.join_network(), test_framework.test_framework.BitcoinTestFramework.main(), rpcbind_test.run_allowip_test(), rpcbind_test.run_bind_test(), fundrawtransaction.RawTransactionsTest.run_test(), fundrawtransaction-hd.RawTransactionsTest.run_test(), wallet.WalletTest.run_test(), test_framework.test_framework.BitcoinTestFramework.split_network(), and test_framework.util.start_nodes().
def test_framework.util.str_to_b64str | ( | string | ) |
Definition at line 114 of file util.py.
Referenced by httpbasics.HTTPBasicsTest.run_test(), and multi_rpc.HTTPBasicsTest.run_test().
def test_framework.util.sync_blocks | ( | rpc_connections, | |
wait = 1 |
|||
) |
Wait until everybody has the same block count
Definition at line 117 of file util.py.
Referenced by bip68-sequence.BIP68Test.activateCSV(), pruning.PruneTest.create_big_chain(), pruning.PruneTest.create_chain_with_staleblocks(), test_framework.util.initialize_chain(), sendheaders.SendHeadersTest.mine_reorg(), pruning.PruneTest.reorg_test(), abandonconflict.AbandonConflictTest.run_test(), txn_doublespend.TxnMallTest.run_test(), txn_clone.TxnMallTest.run_test(), invalidateblock.InvalidateTest.run_test(), wallet.WalletTest.run_test(), mempool_packages.MempoolPackagesTest.run_test(), walletbackup.WalletBackupTest.run_test(), test_framework.test_framework.BitcoinTestFramework.sync_all(), and smartfees.EstimateFeeTest.transact_and_mine().
def test_framework.util.sync_masternodes | ( | rpc_connections | ) |
Definition at line 142 of file util.py.
Referenced by p2p-fullblocktest.FullBlockTest.run_test().
def test_framework.util.sync_mempools | ( | rpc_connections, | |
wait = 1 |
|||
) |
Wait until everybody has the same transactions in their memory pools
Definition at line 127 of file util.py.
Referenced by walletbackup.WalletBackupTest.do_one_round(), listtransactions.ListTransactionsTest.run_rbf_opt_in_test(), abandonconflict.AbandonConflictTest.run_test(), wallet.WalletTest.run_test(), mempool_packages.MempoolPackagesTest.run_test(), test_framework.test_framework.BitcoinTestFramework.sync_all(), and smartfees.EstimateFeeTest.transact_and_mine().
def test_framework.util.wait_bitcoinds | ( | ) |
Definition at line 337 of file util.py.
Referenced by test_framework.util.initialize_chain(), test_framework.test_framework.BitcoinTestFramework.join_network(), test_framework.test_framework.BitcoinTestFramework.main(), rpcbind_test.main(), reindex.ReindexTest.reindex(), rpcbind_test.run_allowip_test(), rpcbind_test.run_bind_test(), fundrawtransaction.RawTransactionsTest.run_test(), fundrawtransaction-hd.RawTransactionsTest.run_test(), wallet.WalletTest.run_test(), p2p-versionbits-warning.VersionBitsWarningTest.run_test(), and test_framework.test_framework.BitcoinTestFramework.split_network().
def test_framework.util.wait_for_bitcoind_start | ( | process, | |
url, | |||
i | |||
) |
Wait for dashd to start. This means that RPC is accessible and fully initialized. Raise an exception if dashd exits during initialization.
Definition at line 164 of file util.py.
Referenced by test_framework.util.initialize_chain(), and test_framework.util.start_node().
def test_framework.util.wait_to_sync | ( | node | ) |
Definition at line 87 of file util.py.
Referenced by getblocktemplate_longpoll.GetBlockTemplateLPTest.run_test(), getblocktemplate_proposals.GetBlockTemplateProposalTest.run_test(), test_framework.util.sync_masternodes(), and bip9-softforks.BIP9SoftForksTest.test_BIP().