add signet support

This commit is contained in:
Karl-Johan Alm 2019-07-19 00:14:01 +09:00 committed by neil saitug
parent ff2bfe3bdb
commit 918e130448
5 changed files with 36 additions and 2 deletions

View File

@ -9,6 +9,8 @@
#define BIP32_VER_MAIN_PRIVATE 0x0488ADE4
#define BIP32_VER_TEST_PUBLIC 0x043587CF
#define BIP32_VER_TEST_PRIVATE 0x04358394
#define BIP32_VER_SIGT_PUBLIC 0x043587CF
#define BIP32_VER_SIGT_PRIVATE 0x04358394
const struct chainparams networks[] = {
{.network_name = "bitcoin",
@ -48,6 +50,21 @@ const struct chainparams networks[] = {
.p2sh_version = 196,
.testnet = true,
.bip32_key_version = {.bip32_pubkey_version = BIP32_VER_TEST_PUBLIC, .bip32_privkey_version = BIP32_VER_TEST_PRIVATE}},
{.network_name = "signet",
.bip173_name = "sb",
.bip70_name = "signet",
.genesis_blockhash = {{{.u.u8 = {0x2d, 0x09, 0x8b, 0x08, 0x55, 0x1b, 0xf3, 0xda, 0xb1, 0xa2, 0x72, 0xa8, 0x71, 0x4a, 0x12, 0x9d, 0x06, 0x5c, 0xfb, 0x32, 0xfa, 0x7e, 0x18, 0xdf, 0x00, 0x99, 0x09, 0x5f, 0xbc, 0xd8, 0x53, 0x62}}}},
.rpc_port = 38332,
.cli = "bitcoin-cli",
.cli_args = "-signet",
.dust_limit = { 546 },
.max_funding = AMOUNT_SAT_INIT((1 << 24) - 1),
.max_payment = AMOUNT_MSAT_INIT(0xFFFFFFFFULL),
.when_lightning_became_cool = 1,
.p2pkh_version = 125,
.p2sh_version = 87,
.testnet = true,
.bip32_key_version = {.bip32_pubkey_version = BIP32_VER_SIGT_PUBLIC, .bip32_privkey_version = BIP32_VER_SIGT_PRIVATE}},
{.network_name = "testnet",
.bip173_name = "tb",
.bip70_name = "test",

View File

@ -82,6 +82,12 @@ Alias for
\fInetwork=testnet\fR\&.
.RE
.PP
\fBsignet\fR
.RS 4
Alias for
\fInetwork=signet\fR\&.
.RE
.PP
\fBmainnet\fR
.RS 4
Alias for

View File

@ -67,6 +67,9 @@ Bitcoin control options:
*testnet*::
Alias for 'network=testnet'.
*signet*::
Alias for 'network=signet'.
*mainnet*::
Alias for 'network=bitcoin'.

View File

@ -976,11 +976,11 @@ void jsonrpc_listen(struct jsonrpc *jsonrpc, struct lightningd *ld)
/**
* segwit_addr_net_decode - Try to decode a Bech32 address and detect
* testnet/mainnet/regtest
* testnet/mainnet/regtest/signet
*
* This processes the address and returns a string if it is a Bech32
* address specified by BIP173. The string is set whether it is
* testnet ("tb"), mainnet ("bc"), or regtest ("bcrt")
* testnet ("tb"), mainnet ("bc"), regtest ("bcrt"), or signet ("sb")
* It does not check, witness version and program size restrictions.
*
* Out: witness_version: Pointer to an int that will be updated to contain

View File

@ -220,6 +220,11 @@ static char *opt_set_testnet(struct lightningd *ld)
return opt_set_network("testnet", ld);
}
static char *opt_set_signet(struct lightningd *ld)
{
return opt_set_network("signet", ld);
}
static char *opt_set_mainnet(struct lightningd *ld)
{
return opt_set_network("bitcoin", ld);
@ -403,6 +408,8 @@ static void config_register_opts(struct lightningd *ld)
" regtest, litecoin or litecoin-testnet)");
opt_register_early_noarg("--testnet", opt_set_testnet, ld,
"Alias for --network=testnet");
opt_register_early_noarg("--signet", opt_set_signet, ld,
"Alias for --network=signet");
opt_register_early_noarg("--mainnet", opt_set_mainnet, ld,
"Alias for --network=bitcoin");
opt_register_early_arg("--allow-deprecated-apis",
@ -1022,6 +1029,7 @@ static void add_config(struct lightningd *ld,
|| opt->cb == (void *)version_and_exit
/* These two show up as --network= */
|| opt->cb == (void *)opt_set_testnet
|| opt->cb == (void *)opt_set_signet
|| opt->cb == (void *)opt_set_mainnet
|| opt->cb == (void *)opt_lightningd_usage
|| opt->cb == (void *)test_subdaemons_and_exit