Skip to content

Commit

Permalink
openchannel: add dual-funding fields to hook
Browse files Browse the repository at this point in the history
Adds fields that are only relevant for v2 of openchannel protocol
to the openchannel hook.
  • Loading branch information
niftynei committed Oct 1, 2019
1 parent 579491b commit ba70d8b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- JSON API: `txprepare` includes a parameter `zero_out_change`, which if true leaves the change value as zero. Useful for designating change output for dual-funded transactions. Defaults to false.
- JSON API: `fundchannel_start` now includes `open_channel_version`, a string which indicates
the protocol version used to open the channel.
- Plugin: `openchannel` hook includes fields for v2 channel establishment

- bolt11: support for parsing feature bits (field `9`).

Expand Down
12 changes: 11 additions & 1 deletion lightningd/opening_control.c
Expand Up @@ -972,8 +972,12 @@ openchannel_hook_serialize(struct openchannel_hook_payload *payload,
struct uncommitted_channel *uc = payload->openingd->channel;
json_object_start(stream, "openchannel");
json_add_node_id(stream, "id", &uc->peer->id);
json_add_string(stream, "version", payload->is_v2 ? "1" : "2");
json_add_amount_sat_only(stream, "funding_satoshis",
payload->funding_satoshis);
payload->opener_satoshis);
if (payload->is_v2)
json_add_amount_sat_only(stream, "opener_satoshis",
payload->opener_satoshis);
json_add_amount_msat_only(stream, "push_msat", payload->push_msat);
json_add_amount_sat_only(stream, "dust_limit_satoshis",
payload->dust_limit_satoshis);
Expand All @@ -983,7 +987,13 @@ openchannel_hook_serialize(struct openchannel_hook_payload *payload,
payload->channel_reserve_satoshis);
json_add_amount_msat_only(stream, "htlc_minimum_msat",
payload->htlc_minimum_msat);
if (payload->is_v2)
json_add_amount_sat_only(stream, "available_funds",
payload->available_funds);
json_add_num(stream, "feerate_per_kw", payload->feerate_per_kw);
if (payload->is_v2)
json_add_num(stream, "feerate_per_kw_funding",
payload->feerate_per_kw_funding);
json_add_num(stream, "to_self_delay", payload->to_self_delay);
json_add_num(stream, "max_accepted_htlcs", payload->max_accepted_htlcs);
json_add_num(stream, "channel_flags", payload->channel_flags);
Expand Down

0 comments on commit ba70d8b

Please sign in to comment.