clightning-plugins: add trustedcoin

This commit is contained in:
neverupdate 2022-08-27 01:15:22 -03:00 committed by Otto Sabart
parent c747ddbf32
commit 3d26f72b7f
No known key found for this signature in database
GPG Key ID: 823BAE99F8BE1E3C
3 changed files with 19 additions and 2 deletions

View File

@ -17,6 +17,7 @@ in {
./feeadjuster.nix ./feeadjuster.nix
./prometheus.nix ./prometheus.nix
./summary.nix ./summary.nix
./trustedcoin.nix
./zmq.nix ./zmq.nix
]; ];

View File

@ -9,7 +9,11 @@ let cfg = config.services.clightning.plugins.trustedcoin; in
type = types.package; type = types.package;
default = config.nix-bitcoin.pkgs.trustedcoin; default = config.nix-bitcoin.pkgs.trustedcoin;
defaultText = "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.
'';
}; };
}; };

View File

@ -30,6 +30,15 @@ let
This also disables all DNS lookups, to avoid leaking address information. 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 { dataDir = mkOption {
type = types.path; type = types.path;
default = "/var/lib/clightning"; default = "/var/lib/clightning";
@ -107,13 +116,16 @@ let
network = bitcoind.makeNetworkName "bitcoin" "regtest"; network = bitcoind.makeNetworkName "bitcoin" "regtest";
configFile = pkgs.writeText "config" '' configFile = pkgs.writeText "config" ''
network=${network} 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}"} ${optionalString (cfg.proxy != null) "proxy=${cfg.proxy}"}
always-use-proxy=${boolToString cfg.always-use-proxy} always-use-proxy=${boolToString cfg.always-use-proxy}
bind-addr=${cfg.address}:${toString cfg.port} bind-addr=${cfg.address}:${toString cfg.port}
bitcoin-rpcconnect=${nbLib.address bitcoind.rpc.address} bitcoin-rpcconnect=${nbLib.address bitcoind.rpc.address}
bitcoin-rpcport=${toString bitcoind.rpc.port} bitcoin-rpcport=${toString bitcoind.rpc.port}
bitcoin-rpcuser=${bitcoind.rpc.users.public.name} bitcoin-rpcuser=${bitcoind.rpc.users.public.name}
rpc-file-mode=0660 rpc-file-mode=0660
log-timestamps=false log-timestamps=false
${optionalString (cfg.wallet != null) "wallet=${cfg.wallet}"} ${optionalString (cfg.wallet != null) "wallet=${cfg.wallet}"}