nixos/bitcoind: fix rare startup error

Previously, dhcpcd and bitcoind starting up in parallel could lead to
the following error in bitcoind:
```
bitcoind: libevent: getaddrinfo: address family for nodename not supported
bitcoind: Binding RPC on address 127.0.0.1 port 8332 failed.
bitcoind: Unable to bind any endpoint for
```
After the initial failure, the bitcoind service would always restart successfully.

This race condition, where both applications were simultaneously
manipulating network resources, was only triggered under specific
hardware conditions.

Fix it by running bitcoind after dhcp has started (by running after
`network-online.target`).
This bug and the fix only affect the default NixOS scripted
networking backend.
This commit is contained in:
Erik Arvstedt 2022-11-02 12:02:52 +01:00
parent 3c86c4cea7
commit 828cd4c895
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -204,7 +204,7 @@ in
'';
in {
description = "Bitcoin daemon";
after = [ "network.target" ];
after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = cfg.user;