Skip to content

Commit 98892f3

Browse files
committed
doc: Improve setup_clean_chain documentation
1 parent 16b784d commit 98892f3

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

Diff for: test/functional/README.md

+7-4
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,13 @@ don't have test cases for.
6363
- Avoid stop-starting the nodes multiple times during the test if possible. A
6464
stop-start takes several seconds, so doing it several times blows up the
6565
runtime of the test.
66-
- Set the `self.setup_clean_chain` variable in `set_test_params()` to control whether
67-
or not to use the cached data directories. The cached data directories
68-
contain a 200-block pre-mined blockchain and wallets for four nodes. Each node
69-
has 25 mature blocks (25x50=1250 BTC) in its wallet.
66+
- Set the `self.setup_clean_chain` variable in `set_test_params()` to `True` to
67+
initialize an empty blockchain and start from the Genesis block, rather than
68+
load a premined blockchain from cache with the default value of `False`. The
69+
cached data directories contain a 200-block pre-mined blockchain with the
70+
spendable mining rewards being split between four nodes. Each node has 25
71+
mature block subsidies (25x50=1250 BTC) in its wallet. Using them is much more
72+
efficient than mining blocks in your test.
7073
- When calling RPCs with lots of arguments, consider using named keyword
7174
arguments instead of positional arguments to make the intent of the call
7275
clear to readers.

Diff for: test/functional/example_test.py

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ def set_test_params(self):
7676
"""Override test parameters for your individual test.
7777
7878
This method must be overridden and num_nodes must be explicitly set."""
79+
# By default every test loads a pre-mined chain of 200 blocks from cache.
80+
# Set setup_clean_chain to True to skip this and start from the Genesis
81+
# block.
7982
self.setup_clean_chain = True
8083
self.num_nodes = 3
8184
# Use self.extra_args to change command-line arguments for the nodes

Diff for: test/functional/test-shell.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ can be called after the TestShell is shut down.
178178
| `num_nodes` | `1` | Sets the number of initialized bitcoind processes. |
179179
| `perf` | False | Profiles running nodes with `perf` for the duration of the test if set to `True`. |
180180
| `rpc_timeout` | `60` | Sets the RPC server timeout for the underlying bitcoind processes. |
181-
| `setup_clean_chain` | `False` | Initializes an empty blockchain by default. A 199-block-long chain is initialized if set to `True`. |
181+
| `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`. |
182182
| `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. |
183183
| `supports_cli` | `False` | Whether the bitcoin-cli utility is compiled and available for the test. |
184184
| `tmpdir` | `"/var/folders/.../"` | Sets directory for test logs. Will be deleted upon a successful test run unless `nocleanup` is set to `True` |

0 commit comments

Comments
 (0)