From 0fd99c4cc0f3da94ba6d65671c23f7b32b27b740 Mon Sep 17 00:00:00 2001 From: nixbitcoin Date: Sun, 7 Jun 2020 11:40:25 +0000 Subject: [PATCH] bitcoind: simplify pruning Remove the possible null value for bitcoind.prune and set prune = 0 in bitcoind as a default. Remove prune = 0 in secure-node.nix and the mkForce in configuration.nix (bitcoind.prune = lib.mkForce ). --- examples/configuration.nix | 3 +-- modules/bitcoind.nix | 10 +++------- modules/presets/secure-node.nix | 1 - 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/examples/configuration.nix b/examples/configuration.nix index d6b6709..e556765 100644 --- a/examples/configuration.nix +++ b/examples/configuration.nix @@ -27,8 +27,7 @@ # clightning is compatible with pruning. See # https://github.com/ElementsProject/lightning/#pruning for more information. # LND and electrs are not compatible with pruning. - # Note: You can override default settings from secure-node.nix as follows - # services.bitcoind.prune = lib.mkForce 100000; + # services.bitcoind.prune = 100000; # # You can add options that are not defined in modules/bitcoind.nix as follows # services.bitcoind.extraConfig = '' diff --git a/modules/bitcoind.nix b/modules/bitcoind.nix index 14d972b..653c52b 100644 --- a/modules/bitcoind.nix +++ b/modules/bitcoind.nix @@ -12,7 +12,7 @@ let ${optionalString cfg.testnet "testnet=1"} ${optionalString (cfg.dbCache != null) "dbcache=${toString cfg.dbCache}"} - ${optionalString (cfg.prune != null) "prune=${toString cfg.prune}"} + "prune=${toString cfg.prune} ${optionalString (cfg.sysperms != null) "sysperms=${if cfg.sysperms then "1" else "0"}"} ${optionalString (cfg.disablewallet != null) "disablewallet=${if cfg.disablewallet then "1" else "0"}"} ${optionalString (cfg.assumevalid != null) "assumevalid=${cfg.assumevalid}"} @@ -179,12 +179,8 @@ in { description = "Override the default database cache size in megabytes."; }; prune = mkOption { - type = types.nullOr (types.coercedTo - (types.enum [ "disable" "manual" ]) - (x: if x == "disable" then 0 else 1) - types.ints.unsigned - ); - default = null; + type = types.ints.unsigned; + default = 0; example = 10000; description = '' Reduce storage requirements by enabling pruning (deleting) of old diff --git a/modules/presets/secure-node.nix b/modules/presets/secure-node.nix index f2a35a7..ca4ab6a 100644 --- a/modules/presets/secure-node.nix +++ b/modules/presets/secure-node.nix @@ -64,7 +64,6 @@ in { addnodes = [ "ecoc5q34tmbq54wl.onion" ]; discover = false; addresstype = "bech32"; - prune = 0; dbCache = 1000; }; services.tor.hiddenServices.bitcoind = mkHiddenService { port = cfg.bitcoind.port; };