df: update the openchannel2 parameter 'accepter' -> 'our'

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`.
This commit is contained in:
niftynei
2021-03-10 22:10:52 -06:00
committed by Rusty Russell
parent a60d652517
commit 8182e9cea4
3 changed files with 8 additions and 9 deletions

View File

@@ -1046,10 +1046,10 @@ before disconnection.
For a 'continue'd result, you can also include a `close_to` address, 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 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. 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 must NOT be accounted for in any supplied output. Change, however, should be
included and should use the `funding_feerate_per_kw` to calculate. included and should use the `funding_feerate_per_kw` to calculate.
@@ -1063,11 +1063,10 @@ e.g.
"result": "continue", "result": "continue",
"close_to": "bc1qlq8srqnz64wgklmqvurv7qnr4rvtq2u96hhfg2" "close_to": "bc1qlq8srqnz64wgklmqvurv7qnr4rvtq2u96hhfg2"
"psbt": "cHNidP8BADMCAAAAAQ+yBipSVZrrw28Oed52hTw3N7t0HbIyZhFdcZRH3+61AQAAAAD9////AGYAAAAAAQDfAgAAAAABARtaSZufCbC+P+/G23XVaQ8mDwZQFW1vlCsCYhLbmVrpAAAAAAD+////AvJs5ykBAAAAFgAUT6ORgb3CgFsbwSOzNLzF7jQS5s+AhB4AAAAAABepFNi369DMyAJmqX2agouvGHcDKsZkhwJHMEQCIHELIyqrqlwRjyzquEPvqiorzL2hrvdu9EBxsqppeIKiAiBykC6De/PDElnqWw49y2vTqauSJIVBgGtSc+vq5BQd+gEhAg0f8WITWvA8o4grxNKfgdrNDncqreMLeRFiteUlne+GZQAAAAEBIICEHgAAAAAAF6kU2Lfr0MzIAmapfZqCi68YdwMqxmSHAQQWABQB+tkKvNZml+JZIWRyLeSpXr7hZQz8CWxpZ2h0bmluZwEIexhVcpJl8ugM/AlsaWdodG5pbmcCAgABAA==", "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, 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. an invalid address will cause the node to exit with an error.

View File

@@ -723,9 +723,9 @@ openchannel2_hook_deserialize(struct openchannel2_payload *payload,
if (json_get_member(buffer, toks, "psbt")) if (json_get_member(buffer, toks, "psbt"))
fatal("Plugin rejected openchannel2 but" fatal("Plugin rejected openchannel2 but"
" also set `psbt`"); " 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" 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, const jsmntok_t *t_errmsg = json_get_member(buffer, toks,
"error_message"); "error_message");
@@ -773,9 +773,9 @@ openchannel2_hook_deserialize(struct openchannel2_payload *payload,
type_to_string(tmpctx, struct wally_psbt, payload->psbt)); type_to_string(tmpctx, struct wally_psbt, payload->psbt));
if (!hook_extract_amount(dualopend, buffer, toks, if (!hook_extract_amount(dualopend, buffer, toks,
"accepter_funding_msat", "our_funding_msat",
&payload->accepter_funding)) &payload->accepter_funding))
fatal("Plugin failed to supply accepter_funding_msat field"); fatal("Plugin failed to supply our_funding_msat field");
if (!payload->psbt && if (!payload->psbt &&
!amount_sat_eq(payload->accepter_funding, AMOUNT_SAT(0))) { !amount_sat_eq(payload->accepter_funding, AMOUNT_SAT(0))) {

View File

@@ -115,7 +115,7 @@ def on_openchannel(openchannel2, plugin, **kwargs):
plugin.log("contributing {} at feerate {}".format(amount, proposed_feerate)) plugin.log("contributing {} at feerate {}".format(amount, proposed_feerate))
return {'result': 'continue', 'psbt': funding['psbt'], return {'result': 'continue', 'psbt': funding['psbt'],
'accepter_funding_msat': amount} 'our_funding_msat': amount}
@plugin.hook('openchannel2_changed') @plugin.hook('openchannel2_changed')