mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
df: add openchannel_abort command
Allows us to clean up an in-progress open that we won't be completing Changelog-Added: EXPERIMENTAL JSON-RPC: Permit user-initiated aborting of in-progress opens. Only valid for not-yet-committed opens and RBF-attempts
This commit is contained in:
parent
015a0555d0
commit
bec96a6c5b
25 changed files with 266 additions and 40 deletions
|
@ -1101,6 +1101,13 @@ class LightningRpc(UnixDomainSocketRpc):
|
|||
}
|
||||
return self.call("openchannel_bump", payload)
|
||||
|
||||
def openchannel_abort(self, channel_id):
|
||||
""" Abort a channel open """
|
||||
payload = {
|
||||
"channel_id": channel_id,
|
||||
}
|
||||
return self.call("openchannel_abort", payload)
|
||||
|
||||
def paystatus(self, bolt11=None):
|
||||
"""Detail status of attempts to pay {bolt11} or any."""
|
||||
payload = {
|
||||
|
|
|
@ -49,6 +49,7 @@ MANPAGES := doc/lightning-cli.1 \
|
|||
doc/lightning-notifications.7 \
|
||||
doc/lightning-offer.7 \
|
||||
doc/lightning-offerout.7 \
|
||||
doc/lightning-openchannel_abort.7 \
|
||||
doc/lightning-openchannel_bump.7 \
|
||||
doc/lightning-openchannel_init.7 \
|
||||
doc/lightning-openchannel_signed.7 \
|
||||
|
|
|
@ -29,6 +29,9 @@ c-lightning Documentation
|
|||
:maxdepth: 1
|
||||
:caption: Manpages
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
>>>>>>> df: add openchannel_abort command
|
||||
lightning-addgossip <lightning-addgossip.7.md>
|
||||
lightning-autocleaninvoice <lightning-autocleaninvoice.7.md>
|
||||
lightning-check <lightning-check.7.md>
|
||||
|
@ -78,6 +81,7 @@ c-lightning Documentation
|
|||
lightning-notifications <lightning-notifications.7.md>
|
||||
lightning-offer <lightning-offer.7.md>
|
||||
lightning-offerout <lightning-offerout.7.md>
|
||||
lightning-openchannel_abort <lightning-openchannel_abort.7.md>
|
||||
lightning-openchannel_bump <lightning-openchannel_bump.7.md>
|
||||
lightning-openchannel_init <lightning-openchannel_init.7.md>
|
||||
lightning-openchannel_signed <lightning-openchannel_signed.7.md>
|
||||
|
|
6
doc/lightning-fundchannel_cancel.7
generated
6
doc/lightning-fundchannel_cancel.7
generated
|
@ -51,11 +51,13 @@ Lisa Neigut \fI<niftynei@gmail.com\fR> is mainly responsible\.
|
|||
|
||||
.SH SEE ALSO
|
||||
|
||||
\fBlightning-connect\fR(7), \fBlightning-fundchannel\fR(7),
|
||||
\fBlightning-connect\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-multifundchannel\fR(7),
|
||||
lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7)
|
||||
lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7),
|
||||
lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBabort\fR(7)
|
||||
|
||||
.SH RESOURCES
|
||||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:e29a875e9a7899adc15fb2f345c982b7cf75a714ae0e1b4367e6531839e7cd73
|
||||
\" SHA256STAMP:72ea44cf6efea20b369fb3ecfb61c8ede142800cbc8b427dbb9a26ec254452ce
|
||||
|
|
|
@ -46,8 +46,10 @@ Lisa Neigut <<niftynei@gmail.com>> is mainly responsible.
|
|||
SEE ALSO
|
||||
--------
|
||||
|
||||
lightning-connect(7), lightning-fundchannel(7),
|
||||
lightning-connect(7), lightning-fundchannel(7), lightning-multifundchannel(7),
|
||||
lightning-fundchannel\_start(7), lightning-fundchannel\_complete(7)
|
||||
lightning-openchannel\_init(7), lightning-openchannel\_update(7),
|
||||
lightning-openchannel\_signed(7), lightning-openchannel\_abort(7)
|
||||
|
||||
RESOURCES
|
||||
---------
|
||||
|
|
5
doc/lightning-fundchannel_complete.7
generated
5
doc/lightning-fundchannel_complete.7
generated
|
@ -55,10 +55,11 @@ Lisa Neigut \fI<niftynei@gmail.com\fR> is mainly responsible\.
|
|||
\fBlightning-connect\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-multifundchannel\fR(7),
|
||||
lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcancel\fR(7),
|
||||
lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7),
|
||||
lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBbump\fR(7)
|
||||
lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBbump\fR(7),
|
||||
lightning-openchannel_\fBabort\fR(7)
|
||||
|
||||
.SH RESOURCES
|
||||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:eea98ffd2086403dd7257878427fa9f3cf4bc9983579d097ee3b65e77760a071
|
||||
\" SHA256STAMP:53e7f55055cdfb8cf66e89ba76a1cfa6fffaa5d6e72b441c44e7e6065707fc66
|
||||
|
|
|
@ -49,7 +49,8 @@ SEE ALSO
|
|||
lightning-connect(7), lightning-fundchannel(7), lightning-multifundchannel(7),
|
||||
lightning-fundchannel\_start(7), lightning-fundchannel\_cancel(7),
|
||||
lightning-openchannel\_init(7), lightning-openchannel\_update(7),
|
||||
lightning-openchannel\_signed(7), lightning-openchannel\_bump(7)
|
||||
lightning-openchannel\_signed(7), lightning-openchannel\_bump(7),
|
||||
lightning-openchannel\_abort(7)
|
||||
|
||||
RESOURCES
|
||||
---------
|
||||
|
|
7
doc/lightning-fundchannel_start.7
generated
7
doc/lightning-fundchannel_start.7
generated
|
@ -76,13 +76,14 @@ Lisa Neigut \fI<niftynei@gmail.com\fR> is mainly responsible\.
|
|||
|
||||
.SH SEE ALSO
|
||||
|
||||
\fBlightning-connect\fR(7), \fBlightning-fundchannel\fR(7),
|
||||
\fBlightning-connect\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-multifundchannel\fR(7),
|
||||
lightning-fundchannel_\fBcomplete\fR(7), lightning-fundchannel_\fBcancel\fR(7)
|
||||
lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7),
|
||||
lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBbump\fR(7)
|
||||
lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBbump\fR(7),
|
||||
lightning-openchannel_\fBabort\fR(7)
|
||||
|
||||
.SH RESOURCES
|
||||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:6bb2a0765fba65c7c7cac11d34221c6c2ed28fe812f058268cd150cd81719977
|
||||
\" SHA256STAMP:6dd30561d6b00b1f2d5595cfe199e09576eb4ba2afea7ba52e8f38546720c76c
|
||||
|
|
|
@ -64,10 +64,11 @@ Lisa Neigut <<niftynei@gmail.com>> is mainly responsible.
|
|||
SEE ALSO
|
||||
--------
|
||||
|
||||
lightning-connect(7), lightning-fundchannel(7),
|
||||
lightning-connect(7), lightning-fundchannel(7), lightning-multifundchannel(7),
|
||||
lightning-fundchannel\_complete(7), lightning-fundchannel\_cancel(7)
|
||||
lightning-openchannel\_init(7), lightning-openchannel\_update(7),
|
||||
lightning-openchannel\_signed(7), lightning-openchannel\_bump(7)
|
||||
lightning-openchannel\_signed(7), lightning-openchannel\_bump(7),
|
||||
lightning-openchannel\_abort(7)
|
||||
|
||||
RESOURCES
|
||||
---------
|
||||
|
|
56
doc/lightning-openchannel_abort.7
generated
Normal file
56
doc/lightning-openchannel_abort.7
generated
Normal file
|
@ -0,0 +1,56 @@
|
|||
.TH "LIGHTNING-OPENCHANNEL_ABORT" "7" "" "" "lightning-openchannel_abort"
|
||||
.SH NAME
|
||||
lightning-openchannel_abort - Command to abort a channel to a peer
|
||||
.SH SYNOPSIS
|
||||
|
||||
\fBopenchannel_abort\fR \fIchannel_id\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
|
||||
\fBopenchannel_init\fR is a low level RPC command which initiates a channel
|
||||
open with a specified peer\. It uses the openchannel protocol
|
||||
which allows for interactive transaction construction\.
|
||||
|
||||
|
||||
\fIchannel_id\fR is id of this channel\.
|
||||
|
||||
.SH RETURN VALUE
|
||||
|
||||
On success, returns the \fIchannel_id\fR for this channel; an boolean indicating
|
||||
if the channel has been successfully canceled, \fIchannel_canceled\fR;
|
||||
a reason for the cancellation, \fIreason\fR\.
|
||||
|
||||
|
||||
On error the returned object will contain \fBcode\fR and \fBmessage\fR properties,
|
||||
with \fBcode\fR being one of the following:
|
||||
|
||||
.RS
|
||||
.IP \[bu]
|
||||
-32602: If the given parameters are wrong\.
|
||||
.IP \[bu]
|
||||
-1: Catchall nonspecific error\.
|
||||
.IP \[bu]
|
||||
305: Peer is not connected\.
|
||||
.IP \[bu]
|
||||
311: Unknown channel id\.
|
||||
.IP \[bu]
|
||||
312: Channel in an invalid state
|
||||
|
||||
.RE
|
||||
.SH SEE ALSO
|
||||
|
||||
lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7),
|
||||
lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBbump\fR(7),
|
||||
lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7),
|
||||
\fBlightning-fundchannel\fR(7), \fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7),
|
||||
\fBlightning-multifundchannel\fR(7)
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
@niftynei \fI<niftynei@gmail.com\fR> is mainly responsible\.
|
||||
|
||||
.SH RESOURCES
|
||||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:3c6aa3f2359134f7468facf69f3f6b925334117079a46ada88ec9b6b8cdd3f0a
|
52
doc/lightning-openchannel_abort.7.md
Normal file
52
doc/lightning-openchannel_abort.7.md
Normal file
|
@ -0,0 +1,52 @@
|
|||
lightning-openchannel\_abort -- Command to abort a channel to a peer
|
||||
=====================================================================
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
**openchannel_abort** *channel_id*
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
`openchannel_init` is a low level RPC command which initiates a channel
|
||||
open with a specified peer. It uses the openchannel protocol
|
||||
which allows for interactive transaction construction.
|
||||
|
||||
*channel_id* is id of this channel.
|
||||
|
||||
|
||||
RETURN VALUE
|
||||
------------
|
||||
|
||||
On success, returns the *channel_id* for this channel; an boolean indicating
|
||||
if the channel has been successfully canceled, *channel_canceled*;
|
||||
a reason for the cancellation, *reason*.
|
||||
|
||||
On error the returned object will contain `code` and `message` properties,
|
||||
with `code` being one of the following:
|
||||
|
||||
- -32602: If the given parameters are wrong.
|
||||
- -1: Catchall nonspecific error.
|
||||
- 305: Peer is not connected.
|
||||
- 311: Unknown channel id.
|
||||
- 312: Channel in an invalid state
|
||||
|
||||
SEE ALSO
|
||||
--------
|
||||
|
||||
lightning-openchannel\_init(7), lightning-openchannel\_update(7),
|
||||
lightning-openchannel\_signed(7), lightning-openchannel\_bump(7),
|
||||
lightning-fundchannel\_start(7), lightning-fundchannel\_complete(7),
|
||||
lightning-fundchannel(7), lightning-fundpsbt(7), lightning-utxopsbt(7),
|
||||
lightning-multifundchannel(7)
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
|
||||
@niftynei <<niftynei@gmail.com>> is mainly responsible.
|
||||
|
||||
RESOURCES
|
||||
---------
|
||||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
5
doc/lightning-openchannel_init.7
generated
5
doc/lightning-openchannel_init.7
generated
|
@ -86,7 +86,8 @@ with \fBcode\fR being one of the following:
|
|||
.SH SEE ALSO
|
||||
|
||||
lightning-openchannel_\fBupdate\fR(7), lightning-openchannel_\fBsigned\fR(7),
|
||||
lightning-openchannel_\fBbump\fR(7) lightning-fundchannel_\fBstart\fR(7),
|
||||
lightning-openchannel_\fBabort\fR(7), lightning-openchannel_\fBbump\fR(7),
|
||||
lightning-fundchannel_\fBstart\fR(7),
|
||||
lightning-fundchannel_\fBcomplete\fR(7), \fBlightning-fundchannel\fR(7),
|
||||
\fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7), \fBlightning-multifundchannel\fR(7)
|
||||
|
||||
|
@ -98,4 +99,4 @@ lightning-fundchannel_\fBcomplete\fR(7), \fBlightning-fundchannel\fR(7),
|
|||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:0db7db257671eb7ea20ee3fafd43ba75902cde08942815e0bb99703114b121e7
|
||||
\" SHA256STAMP:8e37cb8813751e06f59b108e8a335b5b5269e5764c346838a6ddf79138ccea6e
|
||||
|
|
|
@ -70,7 +70,8 @@ SEE ALSO
|
|||
--------
|
||||
|
||||
lightning-openchannel\_update(7), lightning-openchannel\_signed(7),
|
||||
lightning-openchannel\_bump(7) lightning-fundchannel\_start(7),
|
||||
lightning-openchannel\_abort(7), lightning-openchannel\_bump(7),
|
||||
lightning-fundchannel\_start(7),
|
||||
lightning-fundchannel\_complete(7), lightning-fundchannel(7),
|
||||
lightning-fundpsbt(7), lightning-utxopsbt(7), lightning-multifundchannel(7)
|
||||
|
||||
|
|
10
doc/lightning-openchannel_signed.7
generated
10
doc/lightning-openchannel_signed.7
generated
|
@ -56,11 +56,11 @@ with \fBcode\fR being one of the following:
|
|||
.RE
|
||||
.SH SEE ALSO
|
||||
|
||||
=======
|
||||
lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7),
|
||||
lightning-openchannel_\fBbump\fR(7), lightning-fundchannel_\fBstart\fR(7),
|
||||
lightning-fundchannel_\fBcomplete\fR(7), \fBlightning-fundchannel\fR(7),
|
||||
\fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7), \fBlightning-multifundchannel\fR(7)
|
||||
lightning-openchannel_\fBabort\fR(7), lightning-openchannel_\fBbump\fR(7),
|
||||
lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7),
|
||||
\fBlightning-fundchannel\fR(7), \fBlightning-fundpsbt\fR(7),
|
||||
\fBlightning-utxopsbt\fR(7), \fBlightning-multifundchannel\fR(7)
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
|
@ -70,4 +70,4 @@ lightning-fundchannel_\fBcomplete\fR(7), \fBlightning-fundchannel\fR(7),
|
|||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:3004ce5963d892d4828b11d3e5daedb59f780f98485098eba0e46b3e835e759d
|
||||
\" SHA256STAMP:bd874415c73718a0a16c37c9d8cf6fec2944a491b05f2632b1ea2ff35c7a50ae
|
||||
|
|
|
@ -46,11 +46,11 @@ with `code` being one of the following:
|
|||
SEE ALSO
|
||||
--------
|
||||
|
||||
=======
|
||||
lightning-openchannel\_init(7), lightning-openchannel\_update(7),
|
||||
lightning-openchannel\_bump(7), lightning-fundchannel\_start(7),
|
||||
lightning-fundchannel\_complete(7), lightning-fundchannel(7),
|
||||
lightning-fundpsbt(7), lightning-utxopsbt(7), lightning-multifundchannel(7)
|
||||
lightning-openchannel\_abort(7), lightning-openchannel\_bump(7),
|
||||
lightning-fundchannel\_start(7), lightning-fundchannel\_complete(7),
|
||||
lightning-fundchannel(7), lightning-fundpsbt(7),
|
||||
lightning-utxopsbt(7), lightning-multifundchannel(7)
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
|
|
9
doc/lightning-openchannel_update.7
generated
9
doc/lightning-openchannel_update.7
generated
|
@ -67,9 +67,10 @@ in the funding transaction\.
|
|||
.SH SEE ALSO
|
||||
|
||||
lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBsigned\fR(7),
|
||||
lightning-openchannel_\fBbump\fR(7), lightning-fundchannel_\fBstart\fR(7),
|
||||
lightning-fundchannel_\fBcomplete\fR(7), \fBlightning-fundchannel\fR(7),
|
||||
\fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7), \fBlightning-multifundchannel\fR(7)
|
||||
lightning-openchannel_\fBbump\fR(7), lightning-openchannel_\fBabort\fR(7),
|
||||
lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7),
|
||||
\fBlightning-fundchannel\fR(7), \fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7),
|
||||
\fBlightning-multifundchannel\fR(7)
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
|
@ -79,4 +80,4 @@ lightning-fundchannel_\fBcomplete\fR(7), \fBlightning-fundchannel\fR(7),
|
|||
|
||||
Main web site: \fIhttps://github.com/ElementsProject/lightning\fR
|
||||
|
||||
\" SHA256STAMP:93c15eb807f3ee413ebc1eae0cb10970f23fd63ecdae4d31a2f3dce90b5c0b1a
|
||||
\" SHA256STAMP:bc76c4c09f0c4c9c9f1e6b78f9ca495042076abac00c06309a94957646f07974
|
||||
|
|
|
@ -53,9 +53,10 @@ SEE ALSO
|
|||
--------
|
||||
|
||||
lightning-openchannel\_init(7), lightning-openchannel\_signed(7),
|
||||
lightning-openchannel\_bump(7), lightning-fundchannel\_start(7),
|
||||
lightning-fundchannel\_complete(7), lightning-fundchannel(7),
|
||||
lightning-fundpsbt(7), lightning-utxopsbt(7), lightning-multifundchannel(7)
|
||||
lightning-openchannel\_bump(7), lightning-openchannel\_abort(7),
|
||||
lightning-fundchannel\_start(7), lightning-fundchannel\_complete(7),
|
||||
lightning-fundchannel(7), lightning-fundpsbt(7), lightning-utxopsbt(7),
|
||||
lightning-multifundchannel(7)
|
||||
|
||||
AUTHOR
|
||||
------
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <common/closing_fee.h>
|
||||
#include <common/fee_states.h>
|
||||
#include <common/json_command.h>
|
||||
#include <common/json_helpers.h>
|
||||
#include <common/jsonrpc_errors.h>
|
||||
#include <common/utils.h>
|
||||
#include <common/wire_error.h>
|
||||
|
@ -194,6 +195,7 @@ struct open_attempt *new_channel_open_attempt(struct channel *channel)
|
|||
oa->role = channel->opener == LOCAL ? TX_INITIATOR : TX_ACCEPTER;
|
||||
oa->our_upfront_shutdown_script = NULL;
|
||||
oa->cmd = NULL;
|
||||
oa->aborted = false;
|
||||
|
||||
return oa;
|
||||
}
|
||||
|
@ -742,9 +744,22 @@ void channel_cleanup_commands(struct channel *channel, const char *why)
|
|||
{
|
||||
if (channel->open_attempt) {
|
||||
struct open_attempt *oa = channel->open_attempt;
|
||||
if (oa->cmd)
|
||||
if (oa->cmd) {
|
||||
/* If we requested this be aborted, it's a success */
|
||||
if (oa->aborted) {
|
||||
struct json_stream *response;
|
||||
response = json_stream_success(oa->cmd);
|
||||
json_add_channel_id(response,
|
||||
"channel_id",
|
||||
&channel->cid);
|
||||
json_add_bool(response, "channel_canceled",
|
||||
list_empty(&channel->inflights));
|
||||
json_add_string(response, "reason", why);
|
||||
was_pending(command_success(oa->cmd, response));
|
||||
} else
|
||||
was_pending(command_fail(oa->cmd, LIGHTNINGD,
|
||||
"%s", why));
|
||||
}
|
||||
notify_channel_open_failed(channel->peer->ld, &channel->cid);
|
||||
channel->open_attempt = tal_free(channel->open_attempt);
|
||||
}
|
||||
|
|
|
@ -51,6 +51,7 @@ struct open_attempt {
|
|||
struct channel *channel;
|
||||
struct channel_config our_config;
|
||||
enum tx_role role;
|
||||
bool aborted;
|
||||
|
||||
/* On funding_channel struct */
|
||||
struct command *cmd;
|
||||
|
|
|
@ -1874,6 +1874,57 @@ send_msg:
|
|||
subd_send_msg(channel->owner, take(msg));
|
||||
}
|
||||
|
||||
static struct command_result *
|
||||
json_openchannel_abort(struct command *cmd,
|
||||
const char *buffer,
|
||||
const jsmntok_t *obj UNNEEDED,
|
||||
const jsmntok_t *params)
|
||||
{
|
||||
struct channel_id *cid;
|
||||
struct channel *channel;
|
||||
u8 *msg;
|
||||
|
||||
if (!param(cmd, buffer, params,
|
||||
p_req("channel_id", param_channel_id, &cid),
|
||||
NULL))
|
||||
return command_param_failed();
|
||||
|
||||
channel = channel_by_cid(cmd->ld, cid);
|
||||
if (!channel)
|
||||
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, FUNDING_PEER_NOT_CONNECTED,
|
||||
"Peer not connected");
|
||||
|
||||
if (!channel->open_attempt)
|
||||
return command_fail(cmd, FUNDING_STATE_INVALID,
|
||||
"Channel open not in progress");
|
||||
|
||||
if (channel->open_attempt->cmd)
|
||||
return command_fail(cmd, FUNDING_STATE_INVALID,
|
||||
"Another openchannel command"
|
||||
" is in progress");
|
||||
|
||||
if (channel->openchannel_signed_cmd)
|
||||
return command_fail(cmd, FUNDING_STATE_INVALID,
|
||||
"Already sent sigs, waiting for peer's");
|
||||
|
||||
/* Mark it as aborted so when we clean-up, we send the
|
||||
* correct response */
|
||||
channel->open_attempt->aborted = true;
|
||||
channel->open_attempt->cmd = cmd;
|
||||
|
||||
/* Tell dualopend to fail this channel */
|
||||
msg = towire_dualopend_fail(NULL, "Abort requested");
|
||||
subd_send_msg(channel->owner, take(msg));
|
||||
|
||||
return command_still_pending(cmd);
|
||||
}
|
||||
|
||||
static struct command_result *
|
||||
json_openchannel_bump(struct command *cmd,
|
||||
const char *buffer,
|
||||
|
@ -2701,11 +2752,19 @@ static const struct json_command openchannel_bump_command = {
|
|||
"Attempt to bump the fee on {channel_id}'s funding transaction."
|
||||
};
|
||||
|
||||
static const struct json_command openchannel_abort_command = {
|
||||
"openchannel_abort",
|
||||
"channels",
|
||||
json_openchannel_abort,
|
||||
"Abort {channel_id}'s open. Usable while `commitment_signed=false`."
|
||||
};
|
||||
|
||||
#if EXPERIMENTAL_FEATURES
|
||||
AUTODATA(json_command, &openchannel_init_command);
|
||||
AUTODATA(json_command, &openchannel_update_command);
|
||||
AUTODATA(json_command, &openchannel_signed_command);
|
||||
AUTODATA(json_command, &openchannel_bump_command);
|
||||
AUTODATA(json_command, &openchannel_abort_command);
|
||||
#endif /* EXPERIMENTAL_FEATURES */
|
||||
|
||||
static void start_fresh_dualopend(struct peer *peer,
|
||||
|
|
|
@ -96,8 +96,9 @@ def test_v2_rbf(node_factory, bitcoind, chainparams):
|
|||
@unittest.skipIf(not EXPERIMENTAL_FEATURES, "dual-funding is experimental only")
|
||||
def test_v2_rbf_multi(node_factory, bitcoind, chainparams):
|
||||
l1, l2 = node_factory.get_nodes(2,
|
||||
opts=[{'dev-force-features': '+223'},
|
||||
{'dev-force-features': '+223'}])
|
||||
opts={'dev-force-features': '+223',
|
||||
'may_reconnect': True,
|
||||
'allow_warning': True})
|
||||
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||
amount = 2**24
|
||||
|
@ -116,6 +117,11 @@ def test_v2_rbf_multi(node_factory, bitcoind, chainparams):
|
|||
# Check that we're waiting for lockin
|
||||
l1.daemon.wait_for_log(' to DUALOPEND_AWAITING_LOCKIN')
|
||||
|
||||
# Attempt to do abort, should fail since we've
|
||||
# already gotten an inflight
|
||||
with pytest.raises(RpcError):
|
||||
l1.rpc.openchannel_abort(chan_id)
|
||||
|
||||
next_feerate = find_next_feerate(l1, l2)
|
||||
|
||||
# Initiate an RBF
|
||||
|
@ -128,6 +134,14 @@ def test_v2_rbf_multi(node_factory, bitcoind, chainparams):
|
|||
# Do the bump
|
||||
bump = l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt'])
|
||||
|
||||
# Abort this open attempt! We will re-try
|
||||
aborted = l1.rpc.openchannel_abort(chan_id)
|
||||
assert not aborted['channel_canceled']
|
||||
|
||||
# Do the bump, again
|
||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||
bump = l1.rpc.openchannel_bump(chan_id, chan_amount, initpsbt['psbt'])
|
||||
|
||||
update = l1.rpc.openchannel_update(chan_id, bump['psbt'])
|
||||
assert update['commitments_secured']
|
||||
|
||||
|
|
2
wallet/db_postgres_sqlgen.c
generated
2
wallet/db_postgres_sqlgen.c
generated
|
@ -1876,4 +1876,4 @@ struct db_query db_postgres_queries[] = {
|
|||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
||||
|
||||
// SHA256STAMP:69650ac9a0c2d7651aa410d07ae250ff6309660f95ceb157e698b82163003779
|
||||
// SHA256STAMP:e3f864d654fc2c6ea7d527a0ceab875e3d01c4a9884c0810dc5981b8ace7df19
|
||||
|
|
2
wallet/db_sqlite3_sqlgen.c
generated
2
wallet/db_sqlite3_sqlgen.c
generated
|
@ -1876,4 +1876,4 @@ struct db_query db_sqlite3_queries[] = {
|
|||
|
||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
||||
|
||||
// SHA256STAMP:69650ac9a0c2d7651aa410d07ae250ff6309660f95ceb157e698b82163003779
|
||||
// SHA256STAMP:e3f864d654fc2c6ea7d527a0ceab875e3d01c4a9884c0810dc5981b8ace7df19
|
||||
|
|
6
wallet/statements_gettextgen.po
generated
6
wallet/statements_gettextgen.po
generated
|
@ -1230,11 +1230,11 @@ msgstr ""
|
|||
msgid "not a valid SQL statement"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/test/run-wallet.c:1429
|
||||
#: wallet/test/run-wallet.c:1434
|
||||
msgid "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;"
|
||||
msgstr ""
|
||||
|
||||
#: wallet/test/run-wallet.c:1627
|
||||
#: wallet/test/run-wallet.c:1632
|
||||
msgid "INSERT INTO channels (id) VALUES (1);"
|
||||
msgstr ""
|
||||
# SHA256STAMP:a651af64f490359ef2b22638d51be94e8ece9500ebc8efe16dc2c73bb8a473c9
|
||||
# SHA256STAMP:1fc9393bed969dc69c684eb5d842785d2386df6ac5418404d36a0e2a5657e974
|
||||
|
|
|
@ -282,6 +282,11 @@ void json_add_amount_sat_only(struct json_stream *result UNNEEDED,
|
|||
void json_add_bool(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
bool value UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_bool called!\n"); abort(); }
|
||||
/* Generated stub for json_add_channel_id */
|
||||
void json_add_channel_id(struct json_stream *response UNNEEDED,
|
||||
const char *fieldname UNNEEDED,
|
||||
const struct channel_id *cid UNNEEDED)
|
||||
{ fprintf(stderr, "json_add_channel_id called!\n"); abort(); }
|
||||
/* Generated stub for json_add_hex */
|
||||
void json_add_hex(struct json_stream *result UNNEEDED, const char *fieldname UNNEEDED,
|
||||
const void *data UNNEEDED, size_t len UNNEEDED)
|
||||
|
|
Loading…
Add table
Reference in a new issue