Skip to content

Commit

Permalink
cleanup harness
Browse files Browse the repository at this point in the history
  • Loading branch information
buck54321 committed Apr 4, 2022
1 parent 3809d44 commit b44030f
Showing 1 changed file with 6 additions and 38 deletions.
44 changes: 6 additions & 38 deletions dex/testing/doge/harness.sh
Expand Up @@ -8,17 +8,9 @@ ALPHA_LISTEN_PORT="23764"
BETA_LISTEN_PORT="23765"
ALPHA_RPC_PORT="23766"
BETA_RPC_PORT="23767"
ALPHA_WALLET_SEED="cMndqchcXSCUQDDZQSKU2cUHbPb5UfFL9afspxsBELeE6qx6ac9n"
BETA_WALLET_SEED="cRHosJjgZ2UWsEAeHYYUFa8Z6viHYXm94GguGtpzMo6qwKBC1DSq"
ALPHA_MINING_ADDR="mjzB71SzfAi8BwNvobPZ983d8vCdxuQD2i"
BETA_MINING_ADDR="mwL7ypWCMEhBhGcsqWNwkvAasuXP3duXQk"


# Signal that the node needs to restart after encrypting wallet
EXTRA_ARGS="-printtoconsole"
NO_LEGACY_ADDRS="1"
SET_WALLET_FILES="1"

set -ex
NODES_ROOT=~/dextest/${SYMBOL}
rm -rf "${NODES_ROOT}"
Expand All @@ -33,9 +25,9 @@ mkdir -p "${HARNESS_DIR}"

WALLET_PASSWORD="abc"

ALPHA_CLI_CFG="-rpcwallet= -rpcport=${ALPHA_RPC_PORT} -regtest=1 -rpcuser=user -rpcpassword=pass"
ALPHA_CLI_CFG="-rpcport=${ALPHA_RPC_PORT} -regtest=1 -rpcuser=user -rpcpassword=pass"

BETA_CLI_CFG="-rpcwallet= -rpcport=${BETA_RPC_PORT} -regtest=1 -rpcuser=user -rpcpassword=pass"
BETA_CLI_CFG="-rpcport=${BETA_RPC_PORT} -regtest=1 -rpcuser=user -rpcpassword=pass"

# DONE can be used in a send-keys call along with a `wait-for btc` command to
# wait for process termination.
Expand All @@ -50,9 +42,6 @@ SHELL=$(which bash)
# Load prepared wallet if the files exist.
################################################################################

mkdir -p "${ALPHA_DIR}"
mkdir -p "${BETA_DIR}"

mkdir -p ${ALPHA_DIR}/regtest
cp ${SOURCE_DIR}/alpha_wallet.dat ${ALPHA_DIR}/regtest/wallet.dat
mkdir -p ${BETA_DIR}/regtest
Expand Down Expand Up @@ -100,7 +89,7 @@ tmux send-keys -t $SESSION:0 "${DAEMON} -rpcuser=user -rpcpassword=pass \
-debug=rpc -debug=net -debug=mempool -debug=walletdb -debug=addrman -debug=mempoolrej \
-whitelist=127.0.0.0/8 -whitelist=::1 \
-txindex=1 -regtest=1 -port=${ALPHA_LISTEN_PORT} -fallbackfee=0.00001 \
${EXTRA_ARGS}; tmux wait-for -S alpha${SYMBOL}" C-m
-printtoconsole; tmux wait-for -S alpha${SYMBOL}" C-m
sleep 3

################################################################################
Expand All @@ -116,7 +105,7 @@ tmux send-keys -t $SESSION:1 "${DAEMON} -rpcuser=user -rpcpassword=pass \
-rpcport=${BETA_RPC_PORT} -datadir=${BETA_DIR} -txindex=1 -regtest=1 \
-debug=rpc -debug=net -debug=mempool -debug=walletdb -debug=addrman -debug=mempoolrej \
-whitelist=127.0.0.0/8 -whitelist=::1 \
-port=${BETA_LISTEN_PORT} -fallbackfee=0.00001 ${EXTRA_ARGS}; \
-port=${BETA_LISTEN_PORT} -fallbackfee=0.00001 -printtoconsole; \
tmux wait-for -S beta${SYMBOL}" C-m
sleep 3

Expand Down Expand Up @@ -191,41 +180,20 @@ EOF
chmod +x "${HARNESS_DIR}/quit"

################################################################################
# Have to generate a block before calling sethdseed
# Generate the first block
################################################################################
tmux send-keys -t $SESSION:2 "./beta addnode 127.0.0.1:${ALPHA_LISTEN_PORT} add${DONE}" C-m\; ${WAIT}
# This timeout is apparently critical. Give the nodes time to sync.
sleep 1

echo "Generating the genesis block"
tmux send-keys -t $SESSION:2 "./alpha generatetoaddress 1 ${ALPHA_MINING_ADDR}${DONE}" C-m\; ${WAIT}
sleep 1

tmux send-keys -t $SESSION:2 "./alpha walletpassphrase ${WALLET_PASSWORD} 100000000${DONE}" C-m\; ${WAIT}
tmux send-keys -t $SESSION:2 "./beta walletpassphrase ${WALLET_PASSWORD} 100000000${DONE}" C-m\; ${WAIT}


# #################################################################################
# # Generate addresses
# ################################################################################

# tmux send-keys -t $SESSION:2 "./alpha getnewaddress${DONE}" C-m\; ${WAIT}
# tmux send-keys -t $SESSION:2 "./alpha getnewaddress \"\" legacy${DONE}" C-m\; ${WAIT}

# tmux send-keys -t $SESSION:2 "./beta getnewaddress${DONE}" C-m\; ${WAIT}
# tmux send-keys -t $SESSION:2 "./beta getnewaddress \"\" legacy${DONE}" C-m\; ${WAIT}

# tmux send-keys -t $SESSION:2 "./gamma getnewaddress${DONE}" C-m\; ${WAIT}
# tmux send-keys -t $SESSION:2 "./gamma getnewaddress \"\" legacy${DONE}" C-m\; ${WAIT}

# tmux send-keys -t $SESSION:2 "./delta getnewaddress${DONE}" C-m\; ${WAIT}
# tmux send-keys -t $SESSION:2 "./delta getnewaddress \"\" legacy${DONE}" C-m\; ${WAIT}

echo "Generating 400 blocks for alpha"
tmux send-keys -t $SESSION:2 "./alpha generatetoaddress 400 ${ALPHA_MINING_ADDR}${DONE}" C-m\; ${WAIT}

#################################################################################
# Send gamma and delta some coin
# Send beta some coin
################################################################################

# Send the beta wallet some dough.
Expand Down

0 comments on commit b44030f

Please sign in to comment.