From af7f29af4917f61d80b0bdb73c282e9bdabe788e Mon Sep 17 00:00:00 2001 From: Taylor Helsper Date: Mon, 12 Feb 2024 22:27:47 -0600 Subject: [PATCH] Specify consistent localhost IP address for loop and pool (IPv4) --- rootfs/standard/etc/systemd/system/pool.service | 2 +- rootfs/standard/usr/bin/mynode_gen_loop_config.sh | 6 +++++- rootfs/standard/usr/bin/service_scripts/pre_rtl.sh | 3 +++ rootfs/standard/usr/share/mynode/lit.conf | 6 +++--- rootfs/standard/usr/share/mynode/loopd.conf | 12 ++++++++++++ 5 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 rootfs/standard/usr/share/mynode/loopd.conf diff --git a/rootfs/standard/etc/systemd/system/pool.service b/rootfs/standard/etc/systemd/system/pool.service index 8cf261ca..5cca68c2 100644 --- a/rootfs/standard/etc/systemd/system/pool.service +++ b/rootfs/standard/etc/systemd/system/pool.service @@ -11,7 +11,7 @@ ExecStartPre=/usr/bin/is_not_shutting_down.sh ExecStartPre=/usr/bin/wait_on_lnd.sh ExecStartPre=+/usr/bin/mynode_gen_pool_config.sh EnvironmentFile=-/mnt/hdd/mynode/pool/env -ExecStart=/usr/local/bin/poold --network=${NETWORK} --basedir=/mnt/hdd/mynode/pool +ExecStart=/usr/local/bin/poold --network=${NETWORK} --basedir=/mnt/hdd/mynode/pool --rpclisten=127.0.0.1:12010 --restlisten=127.0.0.1:8281 User=bitcoin Group=bitcoin diff --git a/rootfs/standard/usr/bin/mynode_gen_loop_config.sh b/rootfs/standard/usr/bin/mynode_gen_loop_config.sh index 750ee7ec..f0cf1b78 100755 --- a/rootfs/standard/usr/bin/mynode_gen_loop_config.sh +++ b/rootfs/standard/usr/bin/mynode_gen_loop_config.sh @@ -9,4 +9,8 @@ else echo "NETWORK=mainnet" >> /mnt/hdd/mynode/loop/env echo "LND_ADMIN_MACAROON_PATH=/mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon" >> /mnt/hdd/mynode/loop/env fi -chown bitcoin:bitcoin /mnt/hdd/mynode/loop/env \ No newline at end of file +chown bitcoin:bitcoin /mnt/hdd/mynode/loop/env + +# Copy config file +cp -f /usr/share/mynode/loopd.conf /mnt/hdd/mynode/loop/loopd.conf +chown bitcoin:bitcoin /mnt/hdd/mynode/loop/loopd.conf diff --git a/rootfs/standard/usr/bin/service_scripts/pre_rtl.sh b/rootfs/standard/usr/bin/service_scripts/pre_rtl.sh index f68518f8..4c660cfa 100755 --- a/rootfs/standard/usr/bin/service_scripts/pre_rtl.sh +++ b/rootfs/standard/usr/bin/service_scripts/pre_rtl.sh @@ -42,5 +42,8 @@ else sed -i "s/testnet/mainnet/g" /mnt/hdd/mynode/rtl/RTL-Config.json || true fi +# Update for loop connection +sed -i "s/localhost:8081/127.0.0.1:8081/g" /mnt/hdd/mynode/rtl/RTL-Config.json || true + sync sleep 3s \ No newline at end of file diff --git a/rootfs/standard/usr/share/mynode/lit.conf b/rootfs/standard/usr/share/mynode/lit.conf index 652c6150..8f1cd7e0 100644 --- a/rootfs/standard/usr/share/mynode/lit.conf +++ b/rootfs/standard/usr/share/mynode/lit.conf @@ -15,17 +15,17 @@ pool-mode=remote remote.lit-debuglevel=debug # Remote lnd options -remote.lnd.rpcserver=localhost:10009 +remote.lnd.rpcserver=127.0.0.1:10009 remote.lnd.macaroonpath=/mnt/hdd/mynode/lnd/data/chain/bitcoin/mainnet/admin.macaroon remote.lnd.tlscertpath=/mnt/hdd/mynode/lnd/tls.cert # Remote loop options -remote.loop.rpcserver=localhost:11010 +remote.loop.rpcserver=127.0.0.1:11010 remote.loop.macaroonpath=/mnt/hdd/mynode/loop/mainnet/loop.macaroon remote.loop.tlscertpath=/mnt/hdd/mynode/loop/mainnet/tls.cert # Remote pool options -remote.pool.rpcserver=localhost:12010 +remote.pool.rpcserver=127.0.0.1:12010 remote.pool.macaroonpath=/mnt/hdd/mynode/pool/mainnet/pool.macaroon remote.pool.tlscertpath=/mnt/hdd/mynode/pool/mainnet/tls.cert diff --git a/rootfs/standard/usr/share/mynode/loopd.conf b/rootfs/standard/usr/share/mynode/loopd.conf new file mode 100644 index 00000000..34d0a5f3 --- /dev/null +++ b/rootfs/standard/usr/share/mynode/loopd.conf @@ -0,0 +1,12 @@ +# CAN'T LISTEN ON TWO ADDR TYPES +# Some OSes prefer IPv6 for "localhost" which is the default. This can cause +# problems if some things use localhost vs 127.0.0.1 or if some apps prefer IPv4 +# For now, try to patch config files to point to 127.0.0.1 for loop and pool +# since they can't bind to two addresses. + +rpclisten=127.0.0.1:11010 +#rpclisten=[::1]:11010 + +restlisten=127.0.0.1:8081 +#restlisten=[::1]:8081 +