Skip to content

Commit

Permalink
df: update the openchannel2 parameter 'accepter' -> 'our'
Browse files Browse the repository at this point in the history
The `rbf_channel` hook uses `our_funding_msat`, which is a nicer
and more easily understood than the `openchannel2`
`accepter_funding_msat`.

This updates the `openchannel2` hook to use the same nomenclature as
`rbf_channel`.
  • Loading branch information
niftynei authored and rustyrussell committed Mar 12, 2021
1 parent a60d652 commit 8182e9c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
7 changes: 3 additions & 4 deletions doc/PLUGINS.md
Original file line number Diff line number Diff line change
Expand Up @@ -1046,10 +1046,10 @@ before disconnection.

For a 'continue'd result, you can also include a `close_to` address,
which will be used as the output address for a mutual close transaction; you
can include a `psbt` and an `accepter_funding_msat` to contribute funds,
can include a `psbt` and an `our_funding_msat` to contribute funds,
inputs and outputs to this channel open.

Note that, like `openchannel_init`, the `accepter_funding_msat` amount
Note that, like `openchannel_init` RPC call, the `our_funding_msat` amount
must NOT be accounted for in any supplied output. Change, however, should be
included and should use the `funding_feerate_per_kw` to calculate.

Expand All @@ -1063,11 +1063,10 @@ e.g.
"result": "continue",
"close_to": "bc1qlq8srqnz64wgklmqvurv7qnr4rvtq2u96hhfg2"
"psbt": "cHNidP8BADMCAAAAAQ+yBipSVZrrw28Oed52hTw3N7t0HbIyZhFdcZRH3+61AQAAAAD9////AGYAAAAAAQDfAgAAAAABARtaSZufCbC+P+/G23XVaQ8mDwZQFW1vlCsCYhLbmVrpAAAAAAD+////AvJs5ykBAAAAFgAUT6ORgb3CgFsbwSOzNLzF7jQS5s+AhB4AAAAAABepFNi369DMyAJmqX2agouvGHcDKsZkhwJHMEQCIHELIyqrqlwRjyzquEPvqiorzL2hrvdu9EBxsqppeIKiAiBykC6De/PDElnqWw49y2vTqauSJIVBgGtSc+vq5BQd+gEhAg0f8WITWvA8o4grxNKfgdrNDncqreMLeRFiteUlne+GZQAAAAEBIICEHgAAAAAAF6kU2Lfr0MzIAmapfZqCi68YdwMqxmSHAQQWABQB+tkKvNZml+JZIWRyLeSpXr7hZQz8CWxpZ2h0bmluZwEIexhVcpJl8ugM/AlsaWdodG5pbmcCAgABAA==",
"accepter_funding_msat": "39999000msat"
"our_funding_msat": "39999000msat"
}
```


Note that `close_to` must be a valid address for the current chain,
an invalid address will cause the node to exit with an error.

Expand Down
8 changes: 4 additions & 4 deletions lightningd/dual_open_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,9 +723,9 @@ openchannel2_hook_deserialize(struct openchannel2_payload *payload,
if (json_get_member(buffer, toks, "psbt"))
fatal("Plugin rejected openchannel2 but"
" also set `psbt`");
if (json_get_member(buffer, toks, "accepter_funding_msat"))
if (json_get_member(buffer, toks, "our_funding_msat"))
fatal("Plugin rejected openchannel2 but"
" also set `accepter_funding_psbt`");
" also set `our_funding_psbt`");

const jsmntok_t *t_errmsg = json_get_member(buffer, toks,
"error_message");
Expand Down Expand Up @@ -773,9 +773,9 @@ openchannel2_hook_deserialize(struct openchannel2_payload *payload,
type_to_string(tmpctx, struct wally_psbt, payload->psbt));

if (!hook_extract_amount(dualopend, buffer, toks,
"accepter_funding_msat",
"our_funding_msat",
&payload->accepter_funding))
fatal("Plugin failed to supply accepter_funding_msat field");
fatal("Plugin failed to supply our_funding_msat field");

if (!payload->psbt &&
!amount_sat_eq(payload->accepter_funding, AMOUNT_SAT(0))) {
Expand Down
2 changes: 1 addition & 1 deletion tests/plugins/df_accepter.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def on_openchannel(openchannel2, plugin, **kwargs):
plugin.log("contributing {} at feerate {}".format(amount, proposed_feerate))

return {'result': 'continue', 'psbt': funding['psbt'],
'accepter_funding_msat': amount}
'our_funding_msat': amount}


@plugin.hook('openchannel2_changed')
Expand Down

0 comments on commit 8182e9c

Please sign in to comment.