Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/test/run-lease_rates.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ bool fromwire_bool(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
{ fprintf(stderr, "fromwire_fail called!\n"); abort(); }
/* Generated stub for fromwire_lease_rates */
void fromwire_lease_rates(const u8 **cursor UNNEEDED, size_t *plen UNNEEDED, struct lease_rates *lease_rates UNNEEDED)
bool fromwire_lease_rates(const u8 **cursor UNNEEDED, size_t *plen UNNEEDED, struct lease_rates *lease_rates UNNEEDED)
{ fprintf(stderr, "fromwire_lease_rates called!\n"); abort(); }
/* Generated stub for fromwire_secp256k1_ecdsa_signature */
void fromwire_secp256k1_ecdsa_signature(const u8 **cursor UNNEEDED, size_t *max UNNEEDED,
Expand Down
2 changes: 2 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ MANPAGES := doc/lightning-cli.1 \
doc/lightning-delpay.7 \
doc/lightning-disableoffer.7 \
doc/lightning-disconnect.7 \
doc/lightning-emergencyrecover.7 \
doc/lightning-feerates.7 \
doc/lightning-fetchinvoice.7 \
doc/lightning-fundchannel.7 \
Expand Down Expand Up @@ -61,6 +62,7 @@ MANPAGES := doc/lightning-cli.1 \
doc/lightning-pay.7 \
doc/lightning-parsefeerate.7 \
doc/lightning-plugin.7 \
doc/lightning-recoverchannel.7 \
doc/lightning-reserveinputs.7 \
doc/lightning-sendinvoice.7 \
doc/lightning-sendonion.7 \
Expand Down
2 changes: 2 additions & 0 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Core Lightning Documentation
lightning-delpay <lightning-delpay.7.md>
lightning-disableoffer <lightning-disableoffer.7.md>
lightning-disconnect <lightning-disconnect.7.md>
lightning-emergencyrecover <lightning-emergencyrecover.7.md>
lightning-feerates <lightning-feerates.7.md>
lightning-fetchinvoice <lightning-fetchinvoice.7.md>
lightning-fundchannel <lightning-fundchannel.7.md>
Expand Down Expand Up @@ -91,6 +92,7 @@ Core Lightning Documentation
lightning-pay <lightning-pay.7.md>
lightning-ping <lightning-ping.7.md>
lightning-plugin <lightning-plugin.7.md>
lightning-recoverchannel <lightning-recoverchannel.7.md>
lightning-reserveinputs <lightning-reserveinputs.7.md>
lightning-sendcustommsg <lightning-sendcustommsg.7.md>
lightning-sendinvoice <lightning-sendinvoice.7.md>
Expand Down
43 changes: 43 additions & 0 deletions doc/lightning-emergencyrecover.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
lightning-emergencyrecover -- Command for recovering channels from the emergency.recovery file in the lightning directory
=========================================================================================================================

SYNOPSIS
--------

**emergencyrecover**

DESCRIPTION
-----------

The **emergencyrecover** RPC command fetches data from the emergency.recover
file and tries to reconnect to the peer and force him to close the channel.
The data in this file has enough information to reconnect and sweep the funds.

This recovery method is not spontaneous and it depends on the peer, so it should
be used as a last resort to recover the funds stored in a channel in case of severe
data loss.

RETURN VALUE
------------

On success, an object is returned, containing:
- **stubs** (array of hexs):
- Each item is the channel ID of the channel successfully inserted


AUTHOR
------

Aditya <<aditya.sharma20111@gmail.com>> is mainly responsible.

SEE ALSO
--------

lightning-getsharedsecret(7)

RESOURCES
---------

Main web site: <https://github.com/ElementsProject/lightning>

[comment]: # ( SHA256STAMP:9cfaa9eb4609b36accc3e3b12a352c00ddd402307e4461f4df274146d12f6eb0)
45 changes: 45 additions & 0 deletions doc/lightning-recoverchannel.7.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
lightning-recoverchannel -- Command for recovering channels bundeled in an array in the form of *Static Backup*
===============================================================================================================

SYNOPSIS
--------

**recoverchannel** *scb*

DESCRIPTION
-----------

The **recoverchannel** RPC command tries to force the peer (with whom you
already had a channel) to close the channel and sweeps on-chain fund. This
method is not spontaneous and depends on the peer, so use it in case of
severe data loss.

The *scb* parameter is an array containing minimum required info to
reconnect and sweep funds. You can get the scb for already stored channels
by using the RPC command 'staticbackup'


RETURN VALUE
------------

On success, an object is returned, containing:
- **stubs** (array of hexs):
- Each item is the channel ID of the channel successfully inserted


AUTHOR
------

Aditya <<aditya.sharma20111@gmail.com>> is mainly responsible.

SEE ALSO
--------

lightning-getsharedsecret(7)

RESOURCES
---------

Main web site: <https://github.com/ElementsProject/lightning>

[comment]: # ( SHA256STAMP:9cfaa9eb4609b36accc3e3b12a352c00ddd402307e4461f4df274146d12f6eb0)
7 changes: 7 additions & 0 deletions doc/schemas/emergencyrecover.request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [],
"additionalProperties": false,
"properties": {}
}
17 changes: 17 additions & 0 deletions doc/schemas/emergencyrecover.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"stubs"
],
"properties": {
"scb": {
"type": "array",
"items": {
"type": "string",
"description": "Channel IDs of channels successfully inserted."
}
}
}
}
16 changes: 16 additions & 0 deletions doc/schemas/recoverchannel.request.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"scb"
],
"scb": {
"type": "array",
"description": "SCB of the channels in an array",
"items": {
"type": "hexstr"
}
}
}

17 changes: 17 additions & 0 deletions doc/schemas/recoverchannel.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"additionalProperties": false,
"required": [
"stubs"
],
"properties": {
"scb": {
"type": "array",
"items": {
"type": "string",
"description": "Channel IDs of channels successfully inserted."
}
}
}
}
4 changes: 3 additions & 1 deletion lightningd/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,9 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
take(p2wpkh_for_keyidx(NULL, peer->ld,
channel->final_key_idx)));

if (is_stub_scid(scid))
/* scid is NULL when opening a new channel so we don't
* need to set error in that case as well */
if (scid && is_stub_scid(scid))
channel->error = towire_errorfmt(peer->ld,
&channel->cid,
"We can't be together anymore.");
Expand Down
8 changes: 5 additions & 3 deletions lightningd/opening_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -1352,9 +1352,10 @@ static struct command_result *json_commit_channel(struct command *cmd,
size_t scblen = tal_count(scb_arr);

scb_chan = fromwire_scb_chan(cmd ,&scb_arr, &scblen);
if (scb_arr == NULL) {

if (scb_chan == NULL) {
log_broken(cmd->ld->log, "SCB is invalid!");
return;

}

struct lightningd *ld = cmd->ld;
Expand All @@ -1366,7 +1367,8 @@ static struct command_result *json_commit_channel(struct command *cmd,
scb_chan->addr,
scb_chan->funding_sats,
scb_chan->type);



/* Now we put this in the database. */
wallet_channel_insert(ld->wallet, channel);

Expand Down
Loading