Skip to content

Commit

Permalink
Fix console wallet runtime calls
Browse files Browse the repository at this point in the history
Due to changes in how the wallet starts up, it does not
have to run twice anymore if `init` needs to be done. This
PR changes the startup scripts accordingly.
  • Loading branch information
hansieodendaal committed Jan 29, 2021
1 parent 18d054f commit 0cfc900
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 45 deletions.
11 changes: 10 additions & 1 deletion applications/tari_base_node/ubuntu/runtime/start_tor.sh
Expand Up @@ -8,6 +8,15 @@ then
else
no_output=">/dev/null"
fi

# TODO: Fix - The Tor command breaks at `"${no_output}"`; we do not need many Tor terminals if using `start_all`
# TODO: Detect if Tor is running on ports `9050` and `9051` and change startup logic accordingly.

#gnome-terminal --working-directory="$PWD" -- tor --allow-missing-torrc --ignore-missing-torrc \
# --clientonly 1 --socksport 9050 --controlport 127.0.0.1:9051 \
# --log "notice stdout" --clientuseipv6 1 "${no_output}"

gnome-terminal --working-directory="$PWD" -- tor --allow-missing-torrc --ignore-missing-torrc \
--clientonly 1 --socksport 9050 --controlport 127.0.0.1:9051 \
--log "notice stdout" --clientuseipv6 1 "${no_output}"
--log "notice stdout" --clientuseipv6 1

Expand Up @@ -20,26 +20,19 @@ then
ping -c 15 localhost > /dev/null
fi

if [ ! -f "${config_path}/console_wallet_id.json" ]
then
echo Creating new "${config_path}/console_wallet_id.json";
"${exe_path}/tari_console_wallet" --create_id --init --config "${config_path}/config.toml" --log_config "${config_path}/log4rs_console_wallet.yml" --base-path ${base_path}
else
echo Using existing "${config_path}/console_wallet_id.json";
fi

if [ ! -f "${config_path}/log4rs_console_wallet.yml" ]
then
echo Creating new "${config_path}/log4rs_console_wallet.yml";
"${exe_path}/tari_console_wallet" --init --config "${config_path}/config.toml" --log_config "${config_path}/log4rs_console_wallet.yml" --base-path ${base_path}
init_flag="--init"
else
echo Using existing "${config_path}/log4rs_console_wallet.yml";
init_flag=""
fi
echo

# Run
echo Spawning Console Wallet into new terminal..
echo "${exe_path}/tari_console_wallet" --config="${config_path}/config.toml" --log_config="${config_path}/log4rs_console_wallet.yml" --base-path=${base_path} > $exe_path/tari_console_wallet_command.sh
echo "${exe_path}/tari_console_wallet" ${init_flag} --config="${config_path}/config.toml" --log_config="${config_path}/log4rs_console_wallet.yml" --base-path=${base_path} > $exe_path/tari_console_wallet_command.sh
chmod +x $exe_path/tari_console_wallet_command.sh

open -a terminal $exe_path/tari_console_wallet_command.sh
Expand Down
Expand Up @@ -13,23 +13,17 @@ then
fi
"${exe_path}/start_tor.sh"

if [ ! -f "${config_path}/console_wallet_id.json" ]
then
echo Creating new "${config_path}/console_wallet_id.json";
"${exe_path}/tari_console_wallet" --create_id --init --config "${config_path}/config.toml" --log_config "${config_path}/log4rs_console_wallet.yml" --base-path ${base_path}
else
echo Using existing "${config_path}/console_wallet_id.json";
fi
if [ ! -f "${config_path}/log4rs_console_wallet.yml" ]
then
echo Creating new "${config_path}/log4rs_console_wallet.yml";
"${exe_path}/tari_console_wallet" --init --config "${config_path}/config.toml" --log_config "${config_path}/log4rs_console_wallet.yml" --base-path ${base_path}
init_flag="--init"
else
echo Using existing "${config_path}/log4rs_console_wallet.yml";
init_flag=""
fi
echo

# Run
echo Spawning Console Wallet into new terminal..
gnome-terminal --working-directory="$PWD" -- "${exe_path}/tari_console_wallet" --config "${config_path}/config.toml" --log_config "${config_path}/log4rs_console_wallet.yml" --base-path ${base_path}
echo
gnome-terminal --working-directory="$PWD" -- "${exe_path}/tari_console_wallet" ${init_flag} --config "${config_path}/config.toml" --log_config "${config_path}/log4rs_console_wallet.yml" --base-path ${base_path}
Expand Up @@ -135,34 +135,16 @@ if exist "%my_exe_path%\%my_exe%" (
)
)

rem First time run
if not exist "%config_path%\console_wallet_id.json" (
cd "%base_path%"
"%console_wallet%" --create-id --init --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_console_wallet.yml" --base-path "%base_path%"
echo.
echo.
echo Created "%config_path%\console_wallet_id.json".
echo.
) else (
echo.
echo.
echo Using existing "%config_path%\console_wallet_id.json"
echo.
)
echo.
echo.
if not exist "%config_path%\log4rs_console_wallet.yml" (
cd "%base_path%"
"%console_wallet%" --init --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_console_wallet.yml" --base-path "%base_path%"
echo.
echo.
echo Created "%config_path%\log4rs_console_wallet.yml".
echo.
echo Creating new "%config_path%\log4rs_console_wallet.yml".
set INIT_FLAG=--init
) else (
echo.
echo.
echo Using existing "%config_path%\log4rs_console_wallet.yml"
echo.
set INIT_FLAG=
)
echo.

rem Consecutive runs
cd "%base_path%"
"%console_wallet%" --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_console_wallet.yml" --base-path "%base_path%"
"%console_wallet%" %INIT_FLAG% --config "%config_path%\config.toml" --log_config "%config_path%\log4rs_console_wallet.yml" --base-path "%base_path%"

0 comments on commit 0cfc900

Please sign in to comment.