From 477a8002636dee2f9ba20b1d464a4c70c0a2be75 Mon Sep 17 00:00:00 2001 From: minh-bq <97180373+minh-bq@users.noreply.github.com> Date: Fri, 29 Dec 2023 16:18:59 +0700 Subject: [PATCH] entrypoint: move the unlock account logic to right after importing key (#388) Current code does not re-calculate accountsCount after importing private key. As a result, the unlock account logic is not triggered. This commit moves the unlock logic earlier right after we import the key. --- docker/chainnode/entrypoint.sh | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/docker/chainnode/entrypoint.sh b/docker/chainnode/entrypoint.sh index 2a3faa8e83..8290838e7f 100755 --- a/docker/chainnode/entrypoint.sh +++ b/docker/chainnode/entrypoint.sh @@ -132,6 +132,16 @@ if [[ ! -z $PRIVATE_KEY ]]; then fi rm ./private_key unset PRIVATE_KEY + + account=$( + ronin account list --datadir $datadir --keystore $KEYSTORE_DIR \ + 2> /dev/null \ + | head -n 1 \ + | cut -d"{" -f 2 | cut -d"}" -f 1 + ) + echo "Using account $account" + params="$params --unlock $account" + elif [[ "$mine" = "true" ]]; then echo "Warning: A mining node is started without private key environment provided" fi @@ -200,17 +210,6 @@ if [[ "$ENABLE_FAST_FINALITY_SIGN" = "true" ]]; then echo "Using BLS account $blsAccount" fi -if [[ $accountsCount -gt 0 ]]; then - account=$( - ronin account list --datadir $datadir --keystore $KEYSTORE_DIR \ - 2> /dev/null \ - | head -n 1 \ - | cut -d"{" -f 2 | cut -d"}" -f 1 - ) - echo "Using account $account" - params="$params --unlock $account" -fi - # bootnodes if [[ ! -z $BOOTNODES ]]; then params="$params --bootnodes $BOOTNODES"