mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-15 20:09:18 +01:00
lightningd: expose reestablished
field.
This is useful to see if we've really made progress, or just bounced off the peer (e.g. it doesn't know the channel, or we have fallen behind somehow). Changelog-Added: JSON-RPC: `listpeerchannels` new field `reestablished` set once we've exchanged `channel_reestablish` messages. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
40d063cda4
commit
81a280d8a3
6 changed files with 44 additions and 3 deletions
|
@ -133,6 +133,10 @@ On success, an object containing **channels** is returned. It is an array of ob
|
|||
|
||||
- **state** (string): Status of the HTLC (one of "RCVD\_ADD\_HTLC", "RCVD\_ADD\_COMMIT", "SENT\_ADD\_REVOCATION", "SENT\_ADD\_ACK\_COMMIT", "RCVD\_ADD\_ACK\_REVOCATION", "SENT\_REMOVE\_HTLC", "SENT\_REMOVE\_COMMIT", "RCVD\_REMOVE\_REVOCATION", "RCVD\_REMOVE\_ACK\_COMMIT", "SENT\_REMOVE\_ACK\_REVOCATION")
|
||||
|
||||
If **peer\_connected** is *true*:
|
||||
|
||||
- **reestablished** (boolean, optional): True if we have successfully exchanged reestablish messages this connection
|
||||
|
||||
If **close\_to** is present:
|
||||
|
||||
- **close\_to\_addr** (string, optional): The bitcoin address we will close to (present if close\_to\_addr is a standardized address)
|
||||
|
@ -215,4 +219,4 @@ Main web site: <https://github.com/ElementsProject/lightning> Lightning
|
|||
RFC site (BOLT \#9):
|
||||
<https://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md>
|
||||
|
||||
[comment]: # ( SHA256STAMP:a7fc3b30593a04b6b04c1516aeb2039f6ab4e29cf12f81b306a8a068273c3604)
|
||||
[comment]: # ( SHA256STAMP:8cad14f36d38722182a8fdccc393e93d121d97999d2487decfa09d53c991a8ae)
|
||||
|
|
|
@ -352,6 +352,7 @@ The following tables are currently supported:
|
|||
- `local_trimmed` (type `boolean`, sqltype `INTEGER`)
|
||||
- `status` (type `string`, sqltype `TEXT`)
|
||||
- `state` (type `string`, sqltype `TEXT`)
|
||||
- `reestablished` (type `boolean`, sqltype `INTEGER`)
|
||||
- `close_to_addr` (type `string`, sqltype `TEXT`)
|
||||
- `last_tx_fee_msat` (type `msat`, sqltype `INTEGER`)
|
||||
- `direction` (type `u32`, sqltype `INTEGER`)
|
||||
|
@ -530,4 +531,4 @@ RESOURCES
|
|||
---------
|
||||
|
||||
Main web site: <https://github.com/ElementsProject/lightning>
|
||||
[comment]: # ( SHA256STAMP:5c5e14f8fde75b877080c0c10feb786f1d2fefbb61a62aecb8d003d1d54627e9)
|
||||
[comment]: # ( SHA256STAMP:f17b33523de930b61d6397a730c40b2254929cf38930629b9be66f3d52947d0e)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
"type": "boolean",
|
||||
"description": "A boolean flag that is set to true if the peer is online"
|
||||
},
|
||||
"reestablished": {},
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
@ -634,6 +635,7 @@
|
|||
"alias": {},
|
||||
"peer_id": {},
|
||||
"peer_connected": {},
|
||||
"reestablished": {},
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
@ -679,6 +681,7 @@
|
|||
"status": {},
|
||||
"peer_id": {},
|
||||
"peer_connected": {},
|
||||
"reestablished": {},
|
||||
"state": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
|
@ -703,6 +706,26 @@
|
|||
}
|
||||
},
|
||||
"allOf": [
|
||||
{
|
||||
"if": {
|
||||
"properties": {
|
||||
"peer_connected": {
|
||||
"type": "boolean",
|
||||
"enum": [
|
||||
true
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"then": {
|
||||
"properties": {
|
||||
"reestablished": {
|
||||
"type": "boolean",
|
||||
"description": "True if we have successfully exchanged reestablish messages this connection"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"if": {
|
||||
"required": [
|
||||
|
@ -716,6 +739,7 @@
|
|||
"state": {},
|
||||
"peer_id": {},
|
||||
"peer_connected": {},
|
||||
"reestablished": {},
|
||||
"scratch_txid": {},
|
||||
"channel_type": {},
|
||||
"feerate": {},
|
||||
|
@ -807,6 +831,7 @@
|
|||
"state": {},
|
||||
"peer_id": {},
|
||||
"peer_connected": {},
|
||||
"reestablished": {},
|
||||
"alias": {},
|
||||
"scratch_txid": {},
|
||||
"channel_type": {},
|
||||
|
@ -898,6 +923,7 @@
|
|||
"alias": {},
|
||||
"peer_id": {},
|
||||
"peer_connected": {},
|
||||
"reestablished": {},
|
||||
"state": {},
|
||||
"scratch_txid": {},
|
||||
"channel_type": {},
|
||||
|
@ -991,6 +1017,7 @@
|
|||
"state": {},
|
||||
"peer_id": {},
|
||||
"peer_connected": {},
|
||||
"reestablished": {},
|
||||
"scratch_txid": {},
|
||||
"channel_type": {},
|
||||
"feerate": {},
|
||||
|
|
|
@ -410,8 +410,10 @@ static void send_channel_announce_sigs(struct channel *channel)
|
|||
return;
|
||||
|
||||
/* Wait until we've exchanged reestablish messages */
|
||||
if (!channel->reestablished)
|
||||
if (!channel->reestablished) {
|
||||
log_debug(channel->log, "channel_gossip: not sending channel_announcement_sigs until reestablished");
|
||||
return;
|
||||
}
|
||||
|
||||
ca = create_channel_announcement(tmpctx, channel, *channel->scid,
|
||||
NULL, NULL, NULL, NULL);
|
||||
|
@ -843,6 +845,7 @@ void channel_gossip_init_done(struct lightningd *ld)
|
|||
void channel_gossip_channel_reestablished(struct channel *channel)
|
||||
{
|
||||
channel->reestablished = true;
|
||||
log_debug(channel->log, "channel_gossip: reestablished");
|
||||
|
||||
/* Ignore unsaved channels */
|
||||
if (!channel->channel_gossip)
|
||||
|
@ -879,6 +882,7 @@ void channel_gossip_channel_reestablished(struct channel *channel)
|
|||
|
||||
void channel_gossip_channel_disconnect(struct channel *channel)
|
||||
{
|
||||
log_debug(channel->log, "channel_gossip: NO LONGER reestablished");
|
||||
channel->reestablished = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -825,6 +825,9 @@ static void json_add_channel(struct lightningd *ld,
|
|||
if (peer) {
|
||||
json_add_node_id(response, "peer_id", &peer->id);
|
||||
json_add_bool(response, "peer_connected", peer->connected == PEER_CONNECTED);
|
||||
if (peer->connected == PEER_CONNECTED) {
|
||||
json_add_bool(response, "reestablished", channel->reestablished);
|
||||
}
|
||||
json_add_channel_type(response, "channel_type", channel->type);
|
||||
if (channel->ignore_fee_limits) {
|
||||
json_add_bool(response, "ignore_fee_limits", channel->ignore_fee_limits);
|
||||
|
|
|
@ -3840,6 +3840,8 @@ def test_sql(node_factory, bitcoind):
|
|||
'type': 'u64'},
|
||||
{'name': 'out_fulfilled_msat',
|
||||
'type': 'msat'},
|
||||
{'name': 'reestablished',
|
||||
'type': 'boolean'},
|
||||
{'name': 'close_to_addr',
|
||||
'type': 'string'},
|
||||
{'name': 'last_tx_fee_msat',
|
||||
|
|
Loading…
Add table
Reference in a new issue