From e461179472ff542d1c8158f8367b0e71eb0a0894 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=CC=81o=20Haf?= Date: Tue, 27 Aug 2024 20:26:42 +0200 Subject: [PATCH] add `testnet` support --- assets/compat/bitcoin.conf.template | 10 ++++++++++ scripts/services/getConfig.ts | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/assets/compat/bitcoin.conf.template b/assets/compat/bitcoin.conf.template index 0e21c21f..98ab9a39 100644 --- a/assets/compat/bitcoin.conf.template +++ b/assets/compat/bitcoin.conf.template @@ -5,14 +5,18 @@ ## RPC {{#IF rpc.enable {{#IF advanced.pruning.mode = "automatic" +{{#IF !advanced.testnet rpcbind=127.0.0.1:18332 rpcallowip=127.0.0.1/32 }} +}} {{#IF advanced.pruning.mode != "automatic" +{{#IF !advanced.testnet rpcbind=0.0.0.0:8332 rpcallowip=0.0.0.0/0 }} }} +}} rpcuser={{rpc.username}} rpcpassword={{rpc.password}} {{#FOREACH rpc.advanced.auth @@ -41,8 +45,10 @@ mempoolexpiry={{advanced.mempool.mempoolexpiry}} ## PEERS {{#IF advanced.peers.listen listen=1 +{{#IF !advanced.testnet bind=0.0.0.0:8333 }} +}} {{#IF !advanced.peers.listen listen=0 }} @@ -203,4 +209,8 @@ acceptnonstddatacarrier=1 }} {{#IF !blkconstr.acceptnonstddatacarrier acceptnonstddatacarrier=0 +}} + +{{#IF advanced.testnet +testnet=1 }} \ No newline at end of file diff --git a/scripts/services/getConfig.ts b/scripts/services/getConfig.ts index f89ce9a0..3be9ac0c 100644 --- a/scripts/services/getConfig.ts +++ b/scripts/services/getConfig.ts @@ -518,6 +518,12 @@ export const getConfig: T.ExpectedExports.getConfig = async (effects) => { }, }, }, + testnet: { + type: "boolean", + name: "Testnet (EXPERIMENTAL)", + description: "Use testnet instead of mainnet", + default: false, + }, }, }, })(effects);