From 323b2a7f17da7f2717ecfecb3fe1cc8d75be11de Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Tue, 25 Feb 2020 22:00:27 +0000 Subject: [PATCH] Allow adding multiple nodes to bitcoind with the addnodes option and improve bitcoin module option descriptions --- modules/bitcoind.nix | 21 +++++++++++---------- modules/nix-bitcoin.nix | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/modules/bitcoind.nix b/modules/bitcoind.nix index 725e164..e6c44fa 100644 --- a/modules/bitcoind.nix +++ b/modules/bitcoind.nix @@ -20,7 +20,7 @@ let ${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"} listen=${if cfg.listen then "1" else "0"} ${optionalString (cfg.discover != null) "discover=${if cfg.discover then "1" else "0"}"} - ${optionalString (cfg.addnode != null) "addnode=${cfg.addnode}"} + ${lib.concatMapStrings (node: "addnode=${node}\n") cfg.addnodes} # RPC server options @@ -221,20 +221,21 @@ in { type = types.nullOr types.str; default = null; example = "00000000000000000000e5abc3a74fe27dc0ead9c70ea1deb456f11c15fd7bc6"; - description = "If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification"; + description = '' + If this block is in the chain assume that it and its ancestors are + valid and potentially skip their script verification. + ''; }; - addnode = mkOption { - type = types.nullOr types.str; - default = null; - example = "ecoc5q34tmbq54wl.onion"; - description = "Add a node to connect to and attempt to keep the connection open"; + addnodes = mkOption { + type = types.listOf types.str; + default = []; + example = [ "ecoc5q34tmbq54wl.onion" ]; + description = "Add nodes to connect to and attempt to keep the connections open"; }; discover = mkOption { type = types.nullOr types.bool; default = null; - description = '' - Discover own IP addresses - ''; + description = "Discover own IP addresses"; }; addresstype = mkOption { type = types.nullOr types.str; diff --git a/modules/nix-bitcoin.nix b/modules/nix-bitcoin.nix index 0239954..7fec571 100644 --- a/modules/nix-bitcoin.nix +++ b/modules/nix-bitcoin.nix @@ -58,7 +58,7 @@ in { services.bitcoind.zmqpubrawblock = "tcp://127.0.0.1:28332"; services.bitcoind.zmqpubrawtx = "tcp://127.0.0.1:28333"; services.bitcoind.assumevalid = "00000000000000000000e5abc3a74fe27dc0ead9c70ea1deb456f11c15fd7bc6"; - services.bitcoind.addnode = "ecoc5q34tmbq54wl.onion"; + services.bitcoind.addnodes = [ "ecoc5q34tmbq54wl.onion" ]; services.bitcoind.discover = false; services.bitcoind.addresstype = "bech32"; services.bitcoind.prune = 0;