rbf_channel hook: add channel_max_msat parameter

Changelog-Added: Plugins: `rbf_channel` hook has `channel_max_msat` parameter
This commit is contained in:
niftynei
2021-04-23 17:19:56 -05:00
committed by Rusty Russell
parent 4244fc1a53
commit a293bf3269
2 changed files with 13 additions and 1 deletions

View File

@@ -1157,7 +1157,8 @@ requests an RBF for a channel funding transaction.
"funding_feerate_per_kw": 7500,
"feerate_our_max": 10000,
"feerate_our_min": 253,
"locktime": 2453,
"channel_max_msat": "16777215000msat",
"locktime": 2453
}
}
```

View File

@@ -183,6 +183,9 @@ struct rbf_channel_payload {
/* General info */
u32 feerate_our_max;
u32 feerate_our_min;
/* What's the maximum amount of funding
* this channel can hold */
struct amount_sat channel_max;
/* Returned from hook */
struct amount_sat our_funding;
@@ -206,6 +209,8 @@ rbf_channel_hook_serialize(struct rbf_channel_payload *payload,
payload->feerate_our_min);
json_add_num(stream, "funding_feerate_per_kw",
payload->funding_feerate_per_kw);
json_add_amount_sat_only(stream, "channel_max_msat",
payload->channel_max);
json_object_end(stream);
}
@@ -1649,6 +1654,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);
tal_add_destructor2(dualopend, rbf_channel_remove_dualopend, payload);
plugin_hook_call_rbf_channel(dualopend->ld, payload);
}