Skip to content

Commit

Permalink
Merge #366: Update nixpkgs
Browse files Browse the repository at this point in the history
ce10003 lnd: allow curl to retry in the create-wallet script (Jonas Nick)
a23b9d1 lnd: check that state is RPC_ACTIVE after unlocking (Jonas Nick)
c753470 lnd: don't wait until the RPC port is open after unlocking (Jonas Nick)
bc9199a Update nixpkgs (Jonas Nick)
8fbba87 Update nixpkgs (Martin Milata)

Pull request description:

ACKs for top commit:
  nixbitcoin:
    ACK ce10003

Tree-SHA512: 658d74caec7849ff173ce58c7807d5342f39ff159bc40e617e9f28de7696b91e2801f920b183deefea141f9de2db9a9423ce13d31e6b96ff991ab07032522b55
  • Loading branch information
jonasnick committed Jul 9, 2021
2 parents 6c9b1a6 + ce10003 commit 842ed44
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 12 additions & 4 deletions modules/lnd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" ''
Expand Down Expand Up @@ -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
'')
Expand Down
8 changes: 4 additions & 4 deletions pkgs/nixpkgs-pinned.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
}

0 comments on commit 842ed44

Please sign in to comment.