From c5493717b71ea23ddaca7249c9d77e38ea20056a Mon Sep 17 00:00:00 2001 From: Erik Arvstedt Date: Fri, 11 Nov 2022 12:07:40 +0100 Subject: [PATCH] lnd: support `INADDR_ANY` addresses for `bitcoind.zmqpubraw*` Also use `mkDefault` when defining `bitcoind.zmqpubraw*` to simplify overriding for users. --- modules/lnd.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/lnd.nix b/modules/lnd.nix index 893762e..4ad9b97 100644 --- a/modules/lnd.nix +++ b/modules/lnd.nix @@ -175,14 +175,16 @@ let bitcoind.rpchost=${bitcoindRpcAddress}:${toString bitcoind.rpc.port} bitcoind.rpcuser=${bitcoind.rpc.users.${rpcUser}.name} - bitcoind.zmqpubrawblock=${bitcoind.zmqpubrawblock} - bitcoind.zmqpubrawtx=${bitcoind.zmqpubrawtx} + bitcoind.zmqpubrawblock=${zmqHandleSpecialAddress bitcoind.zmqpubrawblock} + bitcoind.zmqpubrawtx=${zmqHandleSpecialAddress bitcoind.zmqpubrawtx} wallet-unlock-password-file=${secretsDir}/lnd-wallet-password ${cfg.extraConfig} ''; + zmqHandleSpecialAddress = builtins.replaceStrings [ "0.0.0.0" "[::]" ] [ "127.0.0.1" "[::1]" ]; + isPruned = bitcoind.prune > 0; # When bitcoind pruning is enabled, lnd requires non-public RPC commands `getpeerinfo`, `getnodeaddresses` # to fetch missing blocks from peers (implemented in btcsuite/btcwallet/chain/pruned_block_dispatcher.go) @@ -212,8 +214,8 @@ in { # under high bitcoind rpc load rpc.threads = 16; - zmqpubrawblock = "tcp://${bitcoindRpcAddress}:28332"; - zmqpubrawtx = "tcp://${bitcoindRpcAddress}:28333"; + zmqpubrawblock = mkDefault "tcp://${bitcoindRpcAddress}:28332"; + zmqpubrawtx = mkDefault "tcp://${bitcoindRpcAddress}:28333"; }; environment.systemPackages = [ cfg.package (hiPrio cfg.cli) ];