df-doc: update error codes, make sure they're correct

This commit is contained in:
niftynei 2021-03-10 22:32:48 -06:00 committed by Rusty Russell
parent 0d581ddc01
commit a648ec827a
7 changed files with 40 additions and 28 deletions

View file

@ -22,17 +22,17 @@ encumbered by the 2-of-2 script for this channel\.
\fIinitialpsbt\fR is the funded, incomplete PSBT that specifies the UTXOs and
change output for our channel contribution\. It can be updated,
see \fBopenchannel_update\fR; \fIinitialpsbt\fR must have at least one input to
provide a PoDLE to the peer\. Must have the Non-Witness UTXO
(PSBT_IN_NON_WITNESS_UTXO) set for every input\. An error
(code 309) will be returned if this requirement is not met\.
see \fBopenchannel_update\fR; \fIinitialpsbt\fR must have at least one input\.
Must have the Non-Witness UTXO (PSBT_IN_NON_WITNESS_UTXO) set for
every input\. An error (code 309) will be returned if this requirement
is not met\.
\fIcommitment_feerate\fR is an optional field\. Sets the feerate for
commitment transactions: see \fBfundchannel\fR\.
\fIfunding_feerate\fR is an optional field\. Sets the feerate for the
\fIfunding_feerate\fR is an optional field\. Sets the feerate for the
funding transaction\. Defaults to 'opening' feerate\.
@ -40,14 +40,14 @@ funding transaction\. Defaults to 'opening' feerate\.
\fIclose_to\fR is a Bitcoin address to which the channel funds should be
sent on close\. Only valid if both peers have negotiated
sent on close\. Only valid if both peers have negotiated
\fBoption_upfront_shutdown_script\fR\.
.SH RETURN VALUE
On success, returns the \fIchannel_id\fR for this channel; an updated
incomplete \fIinitialpsbt\fR for this funding transaction; and the flag
\fIcommitments_secured\fR, which indiciates the completeness of the
\fIcommitments_secured\fR, which indiciates the completeness of the
passed back \fIpsbt\fR\. (Will always be false)\. Also returns the
\fIfunding_serial\fR, indicating the serial_id of the funding output
in the \fIpsbt\fR\.
@ -79,6 +79,8 @@ with \fBcode\fR being one of the following:
309: PSBT missing required fields
.IP \[bu]
310: v2 channel open protocol not supported by peer
.IP \[bu]
312: Channel in an invalid state
.RE
.SH SEE ALSO
@ -96,4 +98,4 @@ lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7),
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
\" SHA256STAMP:d73cf35c01e641d80688352058111421d9213b0a23043e9cdc807398442efd7a
\" SHA256STAMP:d36c10e11609777d0d2523660dab776eb60e739bfadea5db18285cbb002ca91e

View file

@ -21,21 +21,21 @@ encumbered by the 2-of-2 script for this channel.
*initialpsbt* is the funded, incomplete PSBT that specifies the UTXOs and
change output for our channel contribution. It can be updated,
see `openchannel_update`; *initialpsbt* must have at least one input to
provide a PoDLE to the peer. Must have the Non-Witness UTXO
(PSBT\_IN\_NON\_WITNESS\_UTXO) set for every input. An error
(code 309) will be returned if this requirement is not met.
see `openchannel_update`; *initialpsbt* must have at least one input.
Must have the Non-Witness UTXO (PSBT\_IN\_NON\_WITNESS\_UTXO) set for
every input. An error (code 309) will be returned if this requirement
is not met.
*commitment_feerate* is an optional field. Sets the feerate for
commitment transactions: see **fundchannel**.
*funding_feerate* is an optional field. Sets the feerate for the
*funding_feerate* is an optional field. Sets the feerate for the
funding transaction. Defaults to 'opening' feerate.
*announce* is an optional field. Whether or not to announce this channel.
*close_to* is a Bitcoin address to which the channel funds should be
sent on close. Only valid if both peers have negotiated
sent on close. Only valid if both peers have negotiated
`option_upfront_shutdown_script`.
@ -44,7 +44,7 @@ RETURN VALUE
On success, returns the *channel_id* for this channel; an updated
incomplete *initialpsbt* for this funding transaction; and the flag
*commitments_secured*, which indiciates the completeness of the
*commitments_secured*, which indiciates the completeness of the
passed back *psbt*. (Will always be false). Also returns the
*funding_serial*, indicating the serial\_id of the funding output
in the *psbt*.
@ -64,6 +64,7 @@ with `code` being one of the following:
- 306: Unknown peer id.
- 309: PSBT missing required fields
- 310: v2 channel open protocol not supported by peer
- 312: Channel in an invalid state
SEE ALSO
--------

View file

@ -45,9 +45,13 @@ with \fBcode\fR being one of the following:
.IP \[bu]
303: Funding transaction broadcast failed\.
.IP \[bu]
305: Peer is not connected\.
.IP \[bu]
309: PSBT missing required fields\.
.IP \[bu]
311: Unknown channel id\.
.IP \[bu]
312: Channel in an invalid state
.RE
.SH SEE ALSO
@ -65,4 +69,4 @@ lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7),
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
\" SHA256STAMP:93ad9dfed532d0de1481a2f5d3b2030dbaf2f67df69dfcc3724e934d86d332b5
\" SHA256STAMP:1b4fe213f82746ac5773903dfef1bb84d5d80a8c9fdbf5dfc4c02ab2d84164a4

View file

@ -38,8 +38,10 @@ with `code` being one of the following:
- -32602: If the given parameters are wrong.
- -1: Catchall nonspecific error.
- 303: Funding transaction broadcast failed.
- 305: Peer is not connected.
- 309: PSBT missing required fields.
- 311: Unknown channel id.
- 312: Channel in an invalid state
SEE ALSO
--------

View file

@ -60,6 +60,8 @@ in the funding transaction\.
309: PSBT missing required fields
.IP \[bu]
311: Unknown channel id\.
.IP \[bu]
312: Channel in an invalid state
.RE
.SH SEE ALSO
@ -77,4 +79,4 @@ lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7),
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
\" SHA256STAMP:de370bb6e61a0390a50a85e97f533238f379c908cddd822436d0ac4c72b43d6e
\" SHA256STAMP:1da10d582896fe537c439b6a479fc9d8b440a43e6848b21a68b223a0ddaab24b

View file

@ -47,6 +47,7 @@ If *commitments_secured* is true, will also return:
- 305: Peer is not connected.
- 309: PSBT missing required fields
- 311: Unknown channel id.
- 312: Channel in an invalid state
SEE ALSO
--------

View file

@ -1970,20 +1970,20 @@ json_openchannel_signed(struct command *cmd,
return command_fail(cmd, FUNDING_UNKNOWN_CHANNEL,
"Unknown channel");
if (!channel->owner)
return command_fail(cmd, LIGHTNINGD,
return command_fail(cmd, FUNDING_PEER_NOT_CONNECTED,
"Peer not connected");
if (channel->open_attempt)
return command_fail(cmd, LIGHTNINGD,
return command_fail(cmd, FUNDING_STATE_INVALID,
"Commitments for this channel not "
"yet secured, see `openchannel_update`");
if (list_empty(&channel->inflights))
return command_fail(cmd, LIGHTNINGD,
return command_fail(cmd, FUNDING_STATE_INVALID,
"Channel open not initialized yet.");
if (channel->openchannel_signed_cmd)
return command_fail(cmd, LIGHTNINGD,
return command_fail(cmd, FUNDING_STATE_INVALID,
"Already sent sigs, waiting for peer's");
/* Verify that the psbt's txid matches that of the
@ -2016,7 +2016,7 @@ json_openchannel_signed(struct command *cmd,
&inflight->funding->txid));
if (inflight->funding_psbt && psbt_is_finalized(inflight->funding_psbt))
return command_fail(cmd, LIGHTNINGD,
return command_fail(cmd, FUNDING_STATE_INVALID,
"Already have a finalized PSBT for "
"this channel");
@ -2076,20 +2076,20 @@ static struct command_result *json_openchannel_update(struct command *cmd,
channel = channel_by_cid(cmd->ld, cid);
if (!channel)
return command_fail(cmd, LIGHTNINGD,
return command_fail(cmd, FUNDING_UNKNOWN_CHANNEL,
"Unknown channel %s",
type_to_string(tmpctx, struct channel_id,
cid));
if (!channel->owner)
return command_fail(cmd, LIGHTNINGD,
return command_fail(cmd, FUNDING_PEER_NOT_CONNECTED,
"Peer not connected");
if (!channel->open_attempt)
return command_fail(cmd, LIGHTNINGD,
return command_fail(cmd, FUNDING_STATE_INVALID,
"Channel open not in progress");
if (channel->open_attempt->cmd)
return command_fail(cmd, LIGHTNINGD,
return command_fail(cmd, FUNDING_STATE_INVALID,
"Another openchannel command"
" is in progress");
@ -2206,8 +2206,8 @@ static struct command_result *json_openchannel_init(struct command *cmd,
"Peer not connected");
if (channel->open_attempt
|| !list_empty(&channel->inflights))
return command_fail(cmd, LIGHTNINGD, "Channel funding"
" in-progress. %s",
return command_fail(cmd, FUNDING_STATE_INVALID,
"Channel funding in-progress. %s",
channel_state_name(channel));
#if EXPERIMENTAL_FEATURES