chainparams/dual-open: set max_supply; use for max on wumbo channels

We were leaving out the `channel_max_msat` for `openchannel2` when
channels are 'wumbo' (the conversion to msat in the json helper
overflowed, which resulted in the field not being printed)

Changelog-Changed: Plugins: `openchannel2` now always includes the `channel_max_msat`
This commit is contained in:
niftynei 2022-10-17 14:51:22 -05:00 committed by Christian Decker
parent 7c7c4c4cb3
commit 250b190e5f
3 changed files with 16 additions and 4 deletions

View file

@ -50,6 +50,7 @@ const struct chainparams networks[] = {
*/
.max_funding = AMOUNT_SAT_INIT((1 << 24) - 1),
.max_payment = AMOUNT_MSAT_INIT(0xFFFFFFFFULL),
.max_supply = AMOUNT_SAT_INIT(2100000000000000),
/* "Lightning Charge Powers Developers & Blockstream Store" */
.when_lightning_became_cool = 504500,
.p2pkh_version = 0,
@ -76,6 +77,7 @@ const struct chainparams networks[] = {
.dust_limit = { 546 },
.max_funding = AMOUNT_SAT_INIT((1 << 24) - 1),
.max_payment = AMOUNT_MSAT_INIT(0xFFFFFFFFULL),
.max_supply = AMOUNT_SAT_INIT(2100000000000000),
.when_lightning_became_cool = 1,
.p2pkh_version = 111,
.p2sh_version = 196,
@ -102,6 +104,7 @@ const struct chainparams networks[] = {
.dust_limit = { 546 },
.max_funding = AMOUNT_SAT_INIT((1 << 24) - 1),
.max_payment = AMOUNT_MSAT_INIT(0xFFFFFFFFULL),
.max_supply = AMOUNT_SAT_INIT(2100000000000000),
.when_lightning_became_cool = 1,
.p2pkh_version = 111,
.p2sh_version = 196,
@ -126,6 +129,7 @@ const struct chainparams networks[] = {
.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,
@ -150,6 +154,7 @@ const struct chainparams networks[] = {
.dust_limit = { 100000 },
.max_funding = AMOUNT_SAT_INIT(60 * ((1 << 24) - 1)),
.max_payment = AMOUNT_MSAT_INIT(60 * 0xFFFFFFFFULL),
.max_supply = AMOUNT_SAT_INIT(2100000000000000),
.when_lightning_became_cool = 1320000,
.p2pkh_version = 48,
.p2sh_version = 50,
@ -175,6 +180,7 @@ const struct chainparams networks[] = {
.dust_limit = { 100000 },
.max_funding = AMOUNT_SAT_INIT(60 * ((1 << 24) - 1)),
.max_payment = AMOUNT_MSAT_INIT(60 * 0xFFFFFFFFULL),
.max_supply = AMOUNT_SAT_INIT(2100000000000000),
.when_lightning_became_cool = 1,
.p2pkh_version = 111,
.p2sh_version = 58,
@ -199,6 +205,7 @@ const struct chainparams networks[] = {
.dust_limit = {546},
.max_funding = AMOUNT_SAT_INIT((1 << 24) - 1),
.max_payment = AMOUNT_MSAT_INIT(0xFFFFFFFFULL),
.max_supply = AMOUNT_SAT_INIT(2100000000000000),
.when_lightning_became_cool = 1,
.p2pkh_version = 91,
.p2sh_version = 75,
@ -223,6 +230,7 @@ const struct chainparams networks[] = {
.dust_limit = {546},
.max_funding = AMOUNT_SAT_INIT((1 << 24) - 1),
.max_payment = AMOUNT_MSAT_INIT(0xFFFFFFFFULL),
.max_supply = AMOUNT_SAT_INIT(2100000000000000),
.when_lightning_became_cool = 1,
.p2pkh_version = 57,
.p2sh_version = 39,

View file

@ -39,6 +39,8 @@ struct chainparams {
const struct amount_sat dust_limit;
const struct amount_sat max_funding;
const struct amount_msat max_payment;
/* Total coins in network */
const struct amount_sat max_supply;
const u32 when_lightning_became_cool;
const u8 p2pkh_version;
const u8 p2sh_version;

View file

@ -1849,11 +1849,12 @@ static void rbf_got_offer(struct subd *dualopend, const u8 *msg)
/* No error message known (yet) */
payload->err_msg = NULL;
payload->channel_max = chainparams->max_funding;
if (feature_negotiated(dualopend->ld->our_features,
channel->peer->their_features,
OPT_LARGE_CHANNELS))
payload->channel_max = AMOUNT_SAT(UINT_MAX);
payload->channel_max = chainparams->max_supply;
else
payload->channel_max = chainparams->max_funding;
tal_add_destructor2(dualopend, rbf_channel_remove_dualopend, payload);
plugin_hook_call_rbf_channel(dualopend->ld, NULL, payload);
@ -1910,11 +1911,12 @@ static void accepter_got_offer(struct subd *dualopend,
payload->feerate_our_max = feerate_max(dualopend->ld, NULL);
payload->node_blockheight = get_block_height(dualopend->ld->topology);
payload->channel_max = chainparams->max_funding;
if (feature_negotiated(dualopend->ld->our_features,
channel->peer->their_features,
OPT_LARGE_CHANNELS))
payload->channel_max = AMOUNT_SAT(UINT64_MAX);
payload->channel_max = chainparams->max_supply;
else
payload->channel_max = chainparams->max_funding;
tal_add_destructor2(dualopend, openchannel2_remove_dualopend, payload);
plugin_hook_call_openchannel2(dualopend->ld, NULL, payload);