diff --git a/bitcoin/chainparams.c b/bitcoin/chainparams.c index d26e77910871..572f8b16747e 100644 --- a/bitcoin/chainparams.c +++ b/bitcoin/chainparams.c @@ -137,6 +137,32 @@ const struct chainparams networks[] = { .bip32_key_version = {.bip32_pubkey_version = BIP32_VER_TEST_PUBLIC, .bip32_privkey_version = BIP32_VER_TEST_PRIVATE}, .is_elements = false}, + {.network_name = "testnet4", + .onchain_hrp = "tb", + .lightning_hrp = "tb", + .bip70_name = "testnet4", + // 00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043 + .genesis_blockhash = {{{.u.u8 = {0x43, 0xf0, 0x8b, 0xda, 0xb0, 0x50, 0xe3, + 0x5b, 0x56, 0x7c, 0x86, 0x4b, 0x91, 0xf4, + 0x7f, 0x50, 0xae, 0x72, 0x5a, 0xe2, 0xde, + 0x53, 0xbc, 0xfb, 0xba, 0xf2, 0x84, 0xda, + 0x00, 0x00, 0x00, 0x00}}}}, + .rpc_port = 48332, + .ln_port = 49735, + .cli = "bitcoin-cli", + .cli_args = "-testnet4", + .cli_min_supported_version = 150000, + .dust_limit = { 546 }, + .max_funding = AMOUNT_SAT_INIT((1 << 24) - 1), + .max_payment = AMOUNT_MSAT_INIT(0xFFFFFFFFULL), + .max_supply = AMOUNT_SAT_INIT(2100000000000000), + .p2pkh_version = 111, + .p2sh_version = 196, + .testnet = true, + .fee_asset_tag = NULL, + .bip32_key_version = {.bip32_pubkey_version = BIP32_VER_TEST_PUBLIC, + .bip32_privkey_version = BIP32_VER_TEST_PRIVATE}, + .is_elements = false}, {.network_name = "litecoin", .onchain_hrp = "ltc", .lightning_hrp = "ltc", diff --git a/common/configdir.c b/common/configdir.c index c6ac3fdcfbdb..1873074f6f2a 100644 --- a/common/configdir.c +++ b/common/configdir.c @@ -336,6 +336,9 @@ struct configvar **initial_config_opts(const tal_t *ctx, opt_register_early_noarg("--testnet", opt_set_specific_network, "testnet", "Alias for --network=testnet"); + opt_register_early_noarg("--testnet4", + opt_set_specific_network, "testnet4", + "Alias for --network=testnet4"); opt_register_early_noarg("--signet", opt_set_specific_network, "signet", "Alias for --network=signet"); diff --git a/common/json_param.c b/common/json_param.c index 4138144231ff..b95952dd48be 100644 --- a/common/json_param.c +++ b/common/json_param.c @@ -775,11 +775,11 @@ struct command_result *param_secrets_array(struct command *cmd, /** * segwit_addr_net_decode - Try to decode a Bech32(m) address and detect - * testnet/mainnet/regtest/signet + * testnet/mainnet/regtest/signet/testnet4 * * This processes the address and returns a string if it is a Bech32 * address specified by BIP173 or Bech32m as by BIP350. The string is - * set whether it is testnet or signet (both "tb"), mainnet ("bc"), + * set whether it is testnet/testnet4/signet ("tb"), mainnet ("bc"), * regtest ("bcrt"). It does not check witness version and program size * restrictions. * diff --git a/contrib/msggen/msggen/schema.json b/contrib/msggen/msggen/schema.json index e81f2e36938b..01df18599479 100644 --- a/contrib/msggen/msggen/schema.json +++ b/contrib/msggen/msggen/schema.json @@ -20838,6 +20838,10 @@ "set": false, "source": "default" }, + "testnet4": { + "set": false, + "source": "default" + }, "watchtime-blocks": { "value_int": 5, "source": "cmdline" diff --git a/contrib/pyln-spec/bolt1/pyln/spec/bolt1/text.py b/contrib/pyln-spec/bolt1/pyln/spec/bolt1/text.py index 722ededfa0c7..ccc374830c4f 100644 --- a/contrib/pyln-spec/bolt1/pyln/spec/bolt1/text.py +++ b/contrib/pyln-spec/bolt1/pyln/spec/bolt1/text.py @@ -11,6 +11,7 @@ - Bitcoin mainet with port number 9735 or the corresponding hexadecimal `0x2607`; - Bitcoin testnet with port number 19735 (`0x4D17`); - Bitcoin signet with port number 39735 (`0x9B37`). +- Bitcoin testnet4 with port number 49735 (`0xC247`). The Unicode code point for LIGHTNING [1](#reference-1), and the port convention try to follow the Bitcoin Core convention. diff --git a/doc/Makefile b/doc/Makefile index 19d25b76ab1b..beeb6525ea96 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -260,7 +260,7 @@ check-manpages: all-programs check-config-docs default-targets # Makes sure that fields mentioned in schema are in man page, and vice versa. check-config-docs: @for c in `sed -n 's/^ "\(.*\)": {/\1/p' doc/schemas/lightning-listconfigs.json | grep -v '^# version$$' | grep -v '^plugins$$' | grep -v '^important-plugins$$'`; do if ! grep -q "^ \*\*$$c\*\*" doc/lightningd-config.5.md; then echo "$$c undocumented!"; exit 1; fi; done - @for c in `grep -v '\[plugin ' doc/lightningd-config.5.md | sed -n 's/^ \*\*\([^*]*\)\*\*.*/\1/p' | grep -v '^\(help\|version\|mainnet\|testnet\|signet\|plugin\|important-plugin\|plugin-dir\|clear-plugins\)$$'`; do if ! grep -q '"'"$$c"'"' doc/schemas/lightning-listconfigs.json; then echo "$$c documented but not in schema!"; exit 1; fi; done + @for c in `grep -v '\[plugin ' doc/lightningd-config.5.md | sed -n 's/^ \*\*\([^*]*\)\*\*.*/\1/p' | grep -v '^\(help\|version\|mainnet\|testnet\|testnet4\|signet\|plugin\|important-plugin\|plugin-dir\|clear-plugins\)$$'`; do if ! grep -q '"'"$$c"'"' doc/schemas/lightning-listconfigs.json; then echo "$$c documented but not in schema!"; exit 1; fi; done doc-clean: $(RM) $(MANPAGES) $(MARKDOWN_WITH_SCHEMA) doc/.doc_version diff --git a/doc/getting-started/getting-started/configuration.md b/doc/getting-started/getting-started/configuration.md index 5fc9ad6f3c78..9c1352286be5 100644 --- a/doc/getting-started/getting-started/configuration.md +++ b/doc/getting-started/getting-started/configuration.md @@ -63,7 +63,7 @@ The [`lightning-listconfigs`](ref:lightning-listconfigs) command will output a v **network**=_NETWORK_ -- Select the network parameters (_bitcoin_, _testnet_, _signet_, or _regtest_). +- Select the network parameters (_bitcoin_, _testnet_, _testnet4_, _signet_, or _regtest_). This is not valid within the per-network configuration file. - **mainnet** @@ -74,6 +74,10 @@ The [`lightning-listconfigs`](ref:lightning-listconfigs) command will output a v Alias for _network=testnet_. +- **testnet4** + + Alias for _network=testnet4_. + - **signet** Alias for _network=signet_. @@ -384,11 +388,11 @@ You can instead use _addr_ to override this (eg. to change the port), or precise Set an IP address (v4 or v6) or automatic Tor address to listen on and (maybe) announce as our node address. An empty 'IPADDRESS' is a special value meaning bind to IPv4 and/or IPv6 on all interfaces, '0.0.0.0' means bind to all IPv4 interfaces, '::' means 'bind to all IPv6 interfaces' (if you want to specify an IPv6 address _and_ a port, use `[]` around the IPv6 address, like `[::]:9750`). - If 'PORT' is not specified, the default port 9735 is used for mainnet (testnet: 19735, signet: 39735, regtest: 19846). If we can determine a public IP address from the resulting binding, + If 'PORT' is not specified, the default port 9735 is used for mainnet (testnet: 19735, signet: 39735, regtest: 19846, testnet4: 49735). If we can determine a public IP address from the resulting binding, the address is announced. If the argument begins with 'autotor:' then it is followed by the IPv4 or IPv6 address of the Tor control port (default port 9051), and this will be used to configure a Tor hidden service for port 9735 in case of mainnet (bitcoin) network whereas other networks (testnet, - signet, regtest) will set the same default ports they use for non-Tor addresses (see above). + signet, regtest, testnet4) will set the same default ports they use for non-Tor addresses (see above). The Tor hidden service will be configured to point to the first IPv4 or IPv6 address we bind to and is by default unique to your node's id. If the argument begins with 'statictor:' then it is followed by the IPv4 or IPv6 address of the Tor control port (default port 9051), and this will be used to configure a static Tor hidden service. diff --git a/doc/lightning-cli.1.md b/doc/lightning-cli.1.md index 84dd77f466ce..03f8afaa26fc 100644 --- a/doc/lightning-cli.1.md +++ b/doc/lightning-cli.1.md @@ -26,6 +26,7 @@ OPTIONS * **--network**=*network* * **--mainnet** * **--testnet** +* **--testnet4** * **--signet** * **--regtest** diff --git a/doc/lightningd-config.5.md b/doc/lightningd-config.5.md index 1e9d5d014579..f69de5b1f6c9 100644 --- a/doc/lightningd-config.5.md +++ b/doc/lightningd-config.5.md @@ -97,7 +97,7 @@ Bitcoin control options: * **network**=*NETWORK* - Select the network parameters (*bitcoin*, *testnet*, *signet*, or *regtest*). + Select the network parameters (*bitcoin*, *testnet*, *testnet4*, *signet*, or *regtest*). This is not valid within the per-network configuration file. * **mainnet** @@ -112,6 +112,10 @@ This is not valid within the per-network configuration file. Alias for *network=testnet*. +* **testnet4** + + Alias for *network=testnet4*. + * **signet** Alias for *network=signet*. @@ -571,7 +575,7 @@ interfaces, '::' means 'bind to all IPv6 interfaces' (if you want to specify an IPv6 address *and* a port, use `[]` around the IPv6 address, like `[::]:9750`). If 'PORT' is not specified, the default port 9735 is used for mainnet -(testnet: 19735, signet: 39735, regtest: 19846). +(testnet: 19735, signet: 39735, regtest: 19846, testnet4: 49735). If we can determine a public IP address from the resulting binding, the address is announced. @@ -579,8 +583,8 @@ the address is announced. IPv4 or IPv6 address of the Tor control port (default port 9051), and this will be used to configure a Tor hidden service for port 9735 in case of mainnet (bitcoin) network whereas other networks (testnet, -signet, regtest) will set the same default ports they use for non-Tor -addresses (see above). +testnet4, signet, regtest) will set the same default ports they use for +non-Tor addresses (see above). The Tor hidden service will be configured to point to the first IPv4 or IPv6 address we bind to and is by default unique to your node's id. diff --git a/doc/schemas/lightning-listconfigs.json b/doc/schemas/lightning-listconfigs.json index 90803157e354..260dea4c9e87 100644 --- a/doc/schemas/lightning-listconfigs.json +++ b/doc/schemas/lightning-listconfigs.json @@ -2972,6 +2972,10 @@ "set": false, "source": "default" }, + "testnet4": { + "set": false, + "source": "default" + }, "watchtime-blocks": { "value_int": 5, "source": "cmdline" diff --git a/tests/utils.py b/tests/utils.py index ddcc4bb1bace..d24b31ede7e1 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -24,6 +24,7 @@ def default_ln_port(network: str) -> int: "signet": 39735, "liquid-regtest": 20735, "liquid": 9735, + "testnet4": 49735, } return network_map[network] diff --git a/tools/hsmtool.c b/tools/hsmtool.c index 9ab5944ff1a4..94ee25fdbba1 100644 --- a/tools/hsmtool.c +++ b/tools/hsmtool.c @@ -860,7 +860,7 @@ int main(int argc, char *argv[]) next); } - if (net && (streq(net, "testnet") || streq(net, "signet"))) + if (net && (streq(net, "testnet") || streq(net, "testnet4") || streq(net, "signet"))) version = BIP32_VER_TEST_PRIVATE; else if (net && !streq(net, "bitcoin")) errx(ERROR_USAGE, "Network '%s' not supported." diff --git a/tools/reckless b/tools/reckless index f029daafd53b..7677297950de 100755 --- a/tools/reckless +++ b/tools/reckless @@ -1757,7 +1757,7 @@ if __name__ == '__main__': NETWORK = 'regtest' if args.regtest else 'bitcoin' SUPPORTED_NETWORKS = ['bitcoin', 'regtest', 'liquid', 'liquid-regtest', - 'litecoin', 'signet', 'testnet'] + 'litecoin', 'signet', 'testnet', 'testnet4'] if args.version: report_version() elif args.cmd1 is None: