From 925492fc70405c8772af19ac0b6d6aaa72e22035 Mon Sep 17 00:00:00 2001 From: neverupdate Date: Sat, 27 Aug 2022 01:15:22 -0300 Subject: [PATCH] clightning-plugins: add trustedcoin --- modules/clightning-plugins/default.nix | 1 + modules/clightning-plugins/trustedcoin.nix | 6 +++++- modules/clightning.nix | 14 +++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/modules/clightning-plugins/default.nix b/modules/clightning-plugins/default.nix index 8669860..6dd61c7 100644 --- a/modules/clightning-plugins/default.nix +++ b/modules/clightning-plugins/default.nix @@ -17,6 +17,7 @@ in { ./feeadjuster.nix ./prometheus.nix ./summary.nix + ./trustedcoin.nix ./zmq.nix ]; diff --git a/modules/clightning-plugins/trustedcoin.nix b/modules/clightning-plugins/trustedcoin.nix index 7d057c8..9066a52 100644 --- a/modules/clightning-plugins/trustedcoin.nix +++ b/modules/clightning-plugins/trustedcoin.nix @@ -9,7 +9,11 @@ let cfg = config.services.clightning.plugins.trustedcoin; in type = types.package; default = config.nix-bitcoin.pkgs.trustedcoin; defaultText = "config.nix-bitcoin.pkgs.trustedcoin"; - description = "The package providing trustedcoin binaries."; + description = '' + The package providing trustedcoin binaries. Trustedcoin will try to + use a bitcoind as a trusted source for getting block data. If this + fails, it will use a trustedcoin providers instead. + ''; }; }; diff --git a/modules/clightning.nix b/modules/clightning.nix index 7c552be..c30f31d 100644 --- a/modules/clightning.nix +++ b/modules/clightning.nix @@ -30,6 +30,15 @@ let This also disables all DNS lookups, to avoid leaking address information. ''; }; + useBcli = mkOption { + type = types.bool; + default = true; + description = '' + If clightning should use the bitcoind as a main source for getting + on-chain block data. Disable this to use a trustedcoin provider (the + trustedcoin plugin will be automatically enabled). + ''; + }; dataDir = mkOption { type = types.path; default = "/var/lib/clightning"; @@ -107,13 +116,16 @@ let network = bitcoind.makeNetworkName "bitcoin" "regtest"; configFile = pkgs.writeText "config" '' network=${network} - bitcoin-datadir=${bitcoind.dataDir} + ${optionalString (!cfg.useBcli) "disable-plugin=bcli"} + ${optionalString (cfg.useBcli) "bitcoin-datadir=${bitcoind.dataDir}"} ${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"} always-use-proxy=${boolToString cfg.always-use-proxy} bind-addr=${cfg.address}:${toString cfg.port} + bitcoin-rpcconnect=${nbLib.address bitcoind.rpc.address} bitcoin-rpcport=${toString bitcoind.rpc.port} bitcoin-rpcuser=${bitcoind.rpc.users.public.name} + rpc-file-mode=0660 log-timestamps=false ${optionalString (cfg.wallet != null) "wallet=${cfg.wallet}"}