lnd: improve waiting for active RPC server

- Simplify
- Add comment
- Avoid the unneeded default call to sleep
This commit is contained in:
Erik Arvstedt 2021-07-29 20:26:34 +02:00
parent adeccce06e
commit 637a58d826
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -238,13 +238,8 @@ in {
-d "{\"wallet_password\": \"$(cat ${secretsDir}/lnd-wallet-password | tr -d '\n' | base64 -w0)\"}" \ -d "{\"wallet_password\": \"$(cat ${secretsDir}/lnd-wallet-password | tr -d '\n' | base64 -w0)\"}" \
${restUrl}/unlockwallet ${restUrl}/unlockwallet
fi fi
state="" # Wait until the wallet has been unlocked and RPC is fully active
while [ "$state" != "RPC_ACTIVE" ]; do while [[ $(${curl} -d '{}' -X POST ${restUrl}/state | ${pkgs.jq}/bin/jq -r '.state') != RPC_ACTIVE ]]; do
state=$(${curl} \
-d '{}' \
-X POST \
${restUrl}/state |\
${pkgs.jq}/bin/jq -r '.state')
sleep 0.1 sleep 0.1
done done
'') '')