chainparams: Add max_funding_satoshi and max_payment_msat to chainparams

This commit is contained in:
Christian Decker 2018-09-06 18:40:11 +02:00
parent 10167eedd2
commit 8d95917e7c
2 changed files with 28 additions and 0 deletions

View File

@ -12,6 +12,8 @@ const struct chainparams networks[] = {
.cli = "bitcoin-cli", .cli = "bitcoin-cli",
.cli_args = NULL, .cli_args = NULL,
.dust_limit = 546, .dust_limit = 546,
.max_funding_satoshi = (1 << 24) - 1,
.max_payment_msat = 0xFFFFFFFFULL,
/* "Lightning Charge Powers Developers & Blockstream Store" */ /* "Lightning Charge Powers Developers & Blockstream Store" */
.when_lightning_became_cool = 504500, .when_lightning_became_cool = 504500,
.testnet = false}, .testnet = false},
@ -23,6 +25,8 @@ const struct chainparams networks[] = {
.cli = "bitcoin-cli", .cli = "bitcoin-cli",
.cli_args = "-regtest", .cli_args = "-regtest",
.dust_limit = 546, .dust_limit = 546,
.max_funding_satoshi = (1 << 24) - 1,
.max_payment_msat = 0xFFFFFFFFULL,
.when_lightning_became_cool = 1, .when_lightning_became_cool = 1,
.testnet = true}, .testnet = true},
{.index = 2, {.index = 2,
@ -33,6 +37,8 @@ const struct chainparams networks[] = {
.cli = "bitcoin-cli", .cli = "bitcoin-cli",
.cli_args = "-testnet", .cli_args = "-testnet",
.dust_limit = 546, .dust_limit = 546,
.max_funding_satoshi = (1 << 24) - 1,
.max_payment_msat = 0xFFFFFFFFULL,
.testnet = true}, .testnet = true},
{.index = 3, {.index = 3,
.network_name = "litecoin", .network_name = "litecoin",
@ -42,6 +48,8 @@ const struct chainparams networks[] = {
.cli = "litecoin-cli", .cli = "litecoin-cli",
.cli_args = NULL, .cli_args = NULL,
.dust_limit = 100000, .dust_limit = 100000,
.max_funding_satoshi = 60 * ((1 << 24) - 1),
.max_payment_msat = 60 * 0xFFFFFFFFULL,
.when_lightning_became_cool = 1320000, .when_lightning_became_cool = 1320000,
.testnet = false}, .testnet = false},
{.index = 4, {.index = 4,
@ -52,6 +60,8 @@ const struct chainparams networks[] = {
.cli = "litecoin-cli", .cli = "litecoin-cli",
.cli_args = "-testnet", .cli_args = "-testnet",
.dust_limit = 100000, .dust_limit = 100000,
.max_funding_satoshi = 60 * ((1 << 24) - 1),
.max_payment_msat = 60 * 0xFFFFFFFFULL,
.when_lightning_became_cool = 1, .when_lightning_became_cool = 1,
.testnet = true} .testnet = true}
}; };
@ -75,6 +85,16 @@ const struct chainparams *chainparams_by_index(const int index)
} }
} }
const struct chainparams *chainparams_by_chainhash(const struct bitcoin_blkid *chain_hash)
{
for (size_t i = 0; i < ARRAY_SIZE(networks); i++) {
if (bitcoin_blkid_eq(chain_hash, &networks[i].genesis_blockhash)) {
return &networks[i];
}
}
return NULL;
}
const struct chainparams *chainparams_by_bip173(const char *bip173_name) const struct chainparams *chainparams_by_bip173(const char *bip173_name)
{ {
for (size_t i = 0; i < ARRAY_SIZE(networks); i++) { for (size_t i = 0; i < ARRAY_SIZE(networks); i++) {

View File

@ -15,6 +15,8 @@ struct chainparams {
const char *cli; const char *cli;
const char *cli_args; const char *cli_args;
const u64 dust_limit; const u64 dust_limit;
const u64 max_funding_satoshi;
const u64 max_payment_msat;
const u32 when_lightning_became_cool; const u32 when_lightning_became_cool;
/* Whether this is a test network or not */ /* Whether this is a test network or not */
@ -40,4 +42,10 @@ const struct chainparams *chainparams_by_index(const int index);
* This lets us decode BOLT11 addresses. * This lets us decode BOLT11 addresses.
*/ */
const struct chainparams *chainparams_by_bip173(const char *bip173_name); const struct chainparams *chainparams_by_bip173(const char *bip173_name);
/**
* chainparams_by_chainhash - Helper to get a network by its genesis blockhash
*/
const struct chainparams *chainparams_by_chainhash(const struct bitcoin_blkid *chain_hash);
#endif /* LIGHTNING_BITCOIN_CHAINPARAMS_H */ #endif /* LIGHTNING_BITCOIN_CHAINPARAMS_H */