ce10003747 lnd: allow curl to retry in the create-wallet script (Jonas Nick)
a23b9d1c2d lnd: check that state is RPC_ACTIVE after unlocking (Jonas Nick)
c75347027b lnd: don't wait until the RPC port is open after unlocking (Jonas Nick)
bc9199a386 Update nixpkgs (Jonas Nick)
8fbba87c0f Update nixpkgs (Martin Milata)

Pull request description:

ACKs for top commit:
  nixbitcoin:
    ACK ce10003747

Tree-SHA512: 658d74caec7849ff173ce58c7807d5342f39ff159bc40e617e9f28de7696b91e2801f920b183deefea141f9de2db9a9423ce13d31e6b96ff991ab07032522b55
This commit is contained in:
Jonas Nick 2021-07-09 21:44:38 +00:00
commit 842ed44292
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
2 changed files with 16 additions and 8 deletions

View File

@ -198,7 +198,10 @@ in {
RestartSec = "10s";
ReadWritePaths = cfg.dataDir;
ExecStartPost = let
curl = "${pkgs.curl}/bin/curl -s --show-error";
# Retrying is necessary because it can happen that the lnd socket is
# existing, but the RPC service isn't yet, which results in error
# "waiting to start, RPC services not available".
curl = "${pkgs.curl}/bin/curl -s --show-error --retry 10";
restUrl = "https://${cfg.restAddress}:${toString cfg.restPort}/v1";
in [
(nbLib.script "lnd-create-wallet" ''
@ -239,9 +242,14 @@ in {
-d "{\"wallet_password\": \"$(cat ${secretsDir}/lnd-wallet-password | tr -d '\n' | base64 -w0)\"}" \
${restUrl}/unlockwallet
fi
# Wait until the RPC port is open
while ! { exec 3>/dev/tcp/${cfg.rpcAddress}/${toString cfg.rpcPort}; } &>/dev/null; do
state=""
while [ "$state" != "RPC_ACTIVE" ]; do
state=$(${curl} \
--cacert ${secretsDir}/lnd-cert \
-d '{}' \
-X POST \
${restUrl}/state |\
${pkgs.jq}/bin/jq -r '.state')
sleep 0.1
done
'')

View File

@ -8,11 +8,11 @@ in
{
# To update, run ../helper/fetch-channel REV
nixpkgs = fetch {
rev = "dc326c78a93862efb30a76216f527a56496e6284";
sha256 = "094zb1p5i5f2nlxny3dc814jvs90nimdj6wwd80495hgs9z76wgp";
rev = "359e6542e1d41eb18df55c82bdb08bf738fae2cf";
sha256 = "05v28njaas9l26ibc6vy6imvy7grbkli32bmv0n32x6x9cf68gf9";
};
nixpkgs-unstable = fetch {
rev = "4518794ee53d109d551c210a6d195b79e9995a90";
sha256 = "1h86bqrkiydn5nwpndg8k5apdjxff5qigbrrwfam3893vgb7hws2";
rev = "036dc0c709650e0c833822307af801f576d67273";
sha256 = "0pnrygs6xf7id63zi17pq5379hfppwbb5cfazhypcqz6l3dfk00g";
};
}