decred.org/dcrdex@v1.0.5/dex/testing/dcr/README.md (about) 1 # DCR Test Harness 2 3 The harness is a collection of tmux scripts that collectively creates a 4 sandboxed environment for testing dex swap transactions. 5 6 ## Dependencies 7 8 The harness depends on [dcrd](https://github.com/decred/dcrd), [dcrwallet](https://github.com/decred/dcrwallet) and [dcrctl](https://github.com/decred/dcrd/tree/master/cmd/dcrctl) to run. Also requires curl and jq. 9 10 ## Using 11 12 You must have `dcrd` `dcrwallet` `vspd` and `dcrctl` in `PATH` to use the harness. 13 14 The harness script will create two connected simnet nodes and wallets, and 15 then mine some blocks and send some regular transactions. The result is a set of 16 wallets named **alpha** and **beta**, each with slightly different properties. 17 18 **Beta** is purely a mining node/wallet, and will have mostly coinbase 19 UTXOs to spend. 20 21 **Alpha** is a wallet with a range of UTXO values. 22 23 ## Harness control scripts 24 25 The `./harness.sh` script will drop you into a tmux window in a directory 26 called `harness-ctl`. Inside of this directory are a number of scripts to 27 allow you to perform RPC calls against each wallet. 28 29 `./alpha` and `./beta` are just `dcrctl` configured for their respective 30 wallets. 31 Try `./alpha getbalance`, for example. 32 33 `./reorg` will step through a script that causes the alpha or beta node to 34 undergo a 1-deep reorganization. The script takes the following optional 35 arguments: `./reorg {node} {depth}`, where: 36 - `node` is the node that should undergo a reorg, either "alpha" or "beta" (default: alpha) 37 - `depth` is the number of blocks that should be purged from `node` (default: 2). 38 At the end of the reorg, both nodes will have `depth+1` new blocks. 39 40 `./quit` shuts down the nodes and closes the tmux session. 41 42 ## Dev Stuff 43 44 If things aren't looking right, you may need to look at the node windows to 45 see errors. In tmux, you can navigate between windows by typing `Ctrl+b` and 46 then the window number. The window numbers are listed at the bottom 47 of the tmux window. `Ctrl+b` followed by the number `0`, for example, will 48 change to the alpha node window. Examining the node output to look for errors 49 is usually a good first debugging step. 50 51 An unfortunate issue that will pop up if you're fiddling with the script is 52 zombie dcrd processes preventing the harness nodes from binding to the 53 specified ports. You'll have to manually hunt down the zombie PIDs and `kill` 54 them if this happens. 55 56 Don't forget that there may be tests that rely on the existing script's 57 specifics to function correctly. Changes must be tested throughout dcrdex.