Merge fort-nix/nix-bitcoin#412: clightning: fix announce addr

b6d1928e90 clightning: add public port (kon)

Pull request description:

ACKs for top commit:
  erikarvstedt:
    ACK b6d1928e90
  jonasnick:
    ACK b6d1928e90

Tree-SHA512: 78955c453af54d7da42dc7f31474509f6cafe61fae0c3943fc8bd3353d3927b3ed5c2db8bd22600daf2cfd266ef390ead7f6be1c6de7e530f77b091a5285e08a
This commit is contained in:
Jonas Nick 2021-10-26 19:53:51 +00:00
commit c40a7a75cc
No known key found for this signature in database
GPG Key ID: 4861DBF262123605

View File

@ -90,6 +90,12 @@ let
rpc-file-mode=0660
${cfg.extraConfig}
'';
# If the clightning onion service is enabled, use the onion port as the public port
publicPort = if config.nix-bitcoin.onionServices.clightning.enable or false then
(builtins.elemAt config.services.tor.relay.onionServices.clightning.map 0).port
else
cfg.port;
in {
inherit options;
@ -119,7 +125,7 @@ in {
{
echo "bitcoin-rpcpassword=$(cat ${config.nix-bitcoin.secretsDir}/bitcoin-rpcpassword-public)"
${optionalString (cfg.getPublicAddressCmd != "") ''
echo "announce-addr=$(${cfg.getPublicAddressCmd})"
echo "announce-addr=$(${cfg.getPublicAddressCmd}):${toString publicPort}"
''}
} >> '${cfg.dataDir}/config'
'';