#!/usr/bin/env bash # # Copyright (c) 2020-2024 The Decred developers # Use of this source code is governed by an ISC # license that can be found in the LICENSE file. # # Tmux script that sets up a testnet vspd deployment with multiple voting wallets. # # To use the script simply run `./harness.sh` from the repo root. # # By default, the harness script will use `/tmp/vspd-harness` as a working # directory. This can be changed using the `-r` flag, eg: # # ./harness.sh -r /my/harness/path # # The harness script makes a few assumptions about the system it is running on: # - tmux is installed # - dcrd, dcrwallet and vspd are available on $PATH # - Decred testnet chain is already downloaded and sync'd # - dcrd transaction index is already built # - The following files exist: # - ${HOME}/.dcrd/rpc.cert # - ${HOME}/.dcrd/rpc.key # - ${HOME}/.dcrwallet/rpc.cert # - ${HOME}/.dcrwallet/rpc.key set -e TMUX_SESSION="vspd-harness" RPC_USER="user" RPC_PASS="pass" NUMBER_OF_WALLETS=3 DCRD_RPC_CERT="${HOME}/.dcrd/rpc.cert" DCRD_RPC_KEY="${HOME}/.dcrd/rpc.key" WALLET_PASS="12345" WALLET_RPC_CERT="${HOME}/.dcrwallet/rpc.cert" WALLET_RPC_KEY="${HOME}/.dcrwallet/rpc.key" VSPD_FEE_XPUB="tpubVppjaMjp8GEWzpMGHdXNhkjqof8baKGkUzneNEiocnnjnjY9hQPe6mxzZQyzyKYS3u5yxLp8KrJvibqDzc75RGqzkv2JMPYDXmCRR1a39jg" HARNESS_ROOT=/tmp/vspd-harness while getopts r: flag do case "${flag}" in r) HARNESS_ROOT=${OPTARG}; esac done if [ -d "${HARNESS_ROOT}" ]; then while true; do read -p "Wipe existing harness dir? " yn case $yn in [Yy]* ) rm -R "${HARNESS_ROOT}"; break;; [Nn]* ) break;; * ) echo "Please answer yes or no.";; esac done fi tmux new-session -d -s $TMUX_SESSION ################################################# # Setup dcrd. ################################################# tmux rename-window -t $TMUX_SESSION 'dcrd' echo "Writing config for dcrd" mkdir -p "${HARNESS_ROOT}/dcrd" cat > "${HARNESS_ROOT}/dcrd/dcrd.conf" < "${HARNESS_ROOT}/dcrwallet-${i}/dcrwallet.conf" < "${HARNESS_ROOT}/vspd/vspd.conf" <