Skip to content

Commit

Permalink
add signet support
Browse files Browse the repository at this point in the history
  • Loading branch information
kallewoof committed Jul 19, 2019
1 parent ad84897 commit 7eb368a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions bitcoin/chainparams.c
Expand Up @@ -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",
Expand Down Expand Up @@ -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 = false,
.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",
Expand Down
6 changes: 6 additions & 0 deletions doc/lightningd-config.5
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions doc/lightningd-config.5.txt
Expand Up @@ -67,6 +67,9 @@ Bitcoin control options:
*testnet*::
Alias for 'network=testnet'.

*signet*::
Alias for 'network=signet'.

*mainnet*::
Alias for 'network=bitcoin'.

Expand Down
8 changes: 8 additions & 0 deletions lightningd/options.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7eb368a

Please sign in to comment.