mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-25 14:11:27 +02:00
doc: Improve setup_clean_chain documentation
This commit is contained in:
@@ -63,10 +63,13 @@ don't have test cases for.
|
|||||||
- Avoid stop-starting the nodes multiple times during the test if possible. A
|
- Avoid stop-starting the nodes multiple times during the test if possible. A
|
||||||
stop-start takes several seconds, so doing it several times blows up the
|
stop-start takes several seconds, so doing it several times blows up the
|
||||||
runtime of the test.
|
runtime of the test.
|
||||||
- Set the `self.setup_clean_chain` variable in `set_test_params()` to control whether
|
- Set the `self.setup_clean_chain` variable in `set_test_params()` to `True` to
|
||||||
or not to use the cached data directories. The cached data directories
|
initialize an empty blockchain and start from the Genesis block, rather than
|
||||||
contain a 200-block pre-mined blockchain and wallets for four nodes. Each node
|
load a premined blockchain from cache with the default value of `False`. The
|
||||||
has 25 mature blocks (25x50=1250 BTC) in its wallet.
|
cached data directories contain a 200-block pre-mined blockchain with the
|
||||||
|
spendable mining rewards being split between four nodes. Each node has 25
|
||||||
|
mature block subsidies (25x50=1250 BTC) in its wallet. Using them is much more
|
||||||
|
efficient than mining blocks in your test.
|
||||||
- When calling RPCs with lots of arguments, consider using named keyword
|
- When calling RPCs with lots of arguments, consider using named keyword
|
||||||
arguments instead of positional arguments to make the intent of the call
|
arguments instead of positional arguments to make the intent of the call
|
||||||
clear to readers.
|
clear to readers.
|
||||||
|
@@ -76,6 +76,9 @@ class ExampleTest(BitcoinTestFramework):
|
|||||||
"""Override test parameters for your individual test.
|
"""Override test parameters for your individual test.
|
||||||
|
|
||||||
This method must be overridden and num_nodes must be explicitly set."""
|
This method must be overridden and num_nodes must be explicitly set."""
|
||||||
|
# By default every test loads a pre-mined chain of 200 blocks from cache.
|
||||||
|
# Set setup_clean_chain to True to skip this and start from the Genesis
|
||||||
|
# block.
|
||||||
self.setup_clean_chain = True
|
self.setup_clean_chain = True
|
||||||
self.num_nodes = 3
|
self.num_nodes = 3
|
||||||
# Use self.extra_args to change command-line arguments for the nodes
|
# Use self.extra_args to change command-line arguments for the nodes
|
||||||
|
@@ -178,7 +178,7 @@ can be called after the TestShell is shut down.
|
|||||||
| `num_nodes` | `1` | Sets the number of initialized bitcoind processes. |
|
| `num_nodes` | `1` | Sets the number of initialized bitcoind processes. |
|
||||||
| `perf` | False | Profiles running nodes with `perf` for the duration of the test if set to `True`. |
|
| `perf` | False | Profiles running nodes with `perf` for the duration of the test if set to `True`. |
|
||||||
| `rpc_timeout` | `60` | Sets the RPC server timeout for the underlying bitcoind processes. |
|
| `rpc_timeout` | `60` | Sets the RPC server timeout for the underlying bitcoind processes. |
|
||||||
| `setup_clean_chain` | `False` | Initializes an empty blockchain by default. A 199-block-long chain is initialized if set to `True`. |
|
| `setup_clean_chain` | `False` | A 200-block-long chain is initialized from cache by default. Instead, `setup_clean_chain` initializes an empty blockchain if set to `True`. |
|
||||||
| `randomseed` | Random Integer | `TestShell.options.randomseed` is a member of `TestShell` which can be accessed during a test to seed a random generator. User can override default with a constant value for reproducible test runs. |
|
| `randomseed` | Random Integer | `TestShell.options.randomseed` is a member of `TestShell` which can be accessed during a test to seed a random generator. User can override default with a constant value for reproducible test runs. |
|
||||||
| `supports_cli` | `False` | Whether the bitcoin-cli utility is compiled and available for the test. |
|
| `supports_cli` | `False` | Whether the bitcoin-cli utility is compiled and available for the test. |
|
||||||
| `tmpdir` | `"/var/folders/.../"` | Sets directory for test logs. Will be deleted upon a successful test run unless `nocleanup` is set to `True` |
|
| `tmpdir` | `"/var/folders/.../"` | Sets directory for test logs. Will be deleted upon a successful test run unless `nocleanup` is set to `True` |
|
||||||
|
Reference in New Issue
Block a user