Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ This release named by @molxyz and [@ctrlbreak](https://twitter.com/ctrlbreak).
- JSON API: `listpeers`'s `channels` now includes a `private` flag to indicate if channel is announced or not.
- JSON API: `invoice` route hints may now include private channels if you have no public ones, unless new option `exposeprivatechannels` is false.
- Plugins: experimental plugin support for `lightningd`, including option passthrough and JSON-RPC passthrough.
- Protocol: we now support features `option_static_remotekey` and `gossip_queries_ex` for peers.

### Changed

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CCANDIR := ccan

# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
BOLTVERSION := c8e53fe5bf131db142d231e88f2adb3a84876836
BOLTVERSION := 2afe3559e89520ba28b24ff5739491313217ae13

-include config.vars

Expand Down
18 changes: 5 additions & 13 deletions channeld/channeld.c
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,7 @@ static void resend_commitment(struct peer *peer, const struct changed_htlc *last
peer->revocations_received);
}

/* BOLT-531c8d7d9b01ab610b8a73a0deba1b9e9c83e1ed #2:
/* BOLT #2:
*
* A receiving node:
* - if `option_static_remotekey` applies to the commitment transaction:
Expand Down Expand Up @@ -2077,7 +2077,7 @@ static void check_future_dataloss_fields(struct peer *peer,
peer_failed(peer->pps, &peer->channel_id, "Awaiting unilateral close");
}

/* BOLT-531c8d7d9b01ab610b8a73a0deba1b9e9c83e1ed #2:
/* BOLT #2:
*
* A receiving node:
* - if `option_static_remotekey` applies to the commitment transaction:
Expand Down Expand Up @@ -2239,7 +2239,7 @@ static void peer_reconnect(struct peer *peer,
get_per_commitment_point(peer->next_index[LOCAL] - 1,
&my_current_per_commitment_point, NULL);

/* BOLT-531c8d7d9b01ab610b8a73a0deba1b9e9c83e1ed #2:
/* BOLT #2:
*
* - upon reconnection:
* - if a channel is in an error state:
Expand Down Expand Up @@ -2272,7 +2272,6 @@ static void peer_reconnect(struct peer *peer,
* - MUST set `your_last_per_commitment_secret` to the last
* `per_commitment_secret` it received
*/
#if EXPERIMENTAL_FEATURES
if (peer->channel->option_static_remotekey) {
msg = towire_channel_reestablish_option_static_remotekey
(NULL, &peer->channel_id,
Expand All @@ -2281,9 +2280,7 @@ static void peer_reconnect(struct peer *peer,
last_remote_per_commit_secret,
/* Can send any (valid) point here */
&peer->remote_per_commit);
} else
#endif /* EXPERIMENTAL_FEATURES */
if (dataloss_protect) {
} else if (dataloss_protect) {
msg = towire_channel_reestablish_option_data_loss_protect
(NULL, &peer->channel_id,
peer->next_index[LOCAL],
Expand All @@ -2310,7 +2307,6 @@ static void peer_reconnect(struct peer *peer,
} while (handle_peer_gossip_or_error(peer->pps, &peer->channel_id, msg)
|| capture_premature_msg(&premature_msgs, msg));

#if EXPERIMENTAL_FEATURES
if (peer->channel->option_static_remotekey) {
struct pubkey ignore;
if (!fromwire_channel_reestablish_option_static_remotekey(msg,
Expand All @@ -2325,9 +2321,7 @@ static void peer_reconnect(struct peer *peer,
wire_type_name(fromwire_peektype(msg)),
tal_hex(msg, msg));
}
} else
#endif /* EXPERIMENTAL_FEATURES */
if (dataloss_protect) {
} else if (dataloss_protect) {
if (!fromwire_channel_reestablish_option_data_loss_protect(msg,
&channel_id,
&next_commitment_number,
Expand Down Expand Up @@ -3023,9 +3017,7 @@ static void init_channel(struct peer *peer)
feerate_per_kw[LOCAL], feerate_per_kw[REMOTE],
peer->feerate_min, peer->feerate_max);

#if EXPERIMENTAL_FEATURES
status_debug("option_static_remotekey = %u", option_static_remotekey);
#endif

if(remote_ann_node_sig && remote_ann_bitcoin_sig) {
peer->announcement_node_sigs[REMOTE] = *remote_ann_node_sig;
Expand Down
2 changes: 0 additions & 2 deletions common/features.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ static const u32 our_localfeatures[] = {
OPTIONAL_FEATURE(LOCAL_UPFRONT_SHUTDOWN_SCRIPT),
OPTIONAL_FEATURE(LOCAL_GOSSIP_QUERIES),
OPTIONAL_FEATURE(LOCAL_GOSSIP_QUERIES_EX),
#if EXPERIMENTAL_FEATURES
OPTIONAL_FEATURE(LOCAL_STATIC_REMOTEKEY),
#endif
};

static const u32 our_globalfeatures[] = {
Expand Down
2 changes: 1 addition & 1 deletion common/features.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void set_feature_bit(u8 **ptr, u32 bit);
#define LOCAL_GOSSIP_QUERIES 6
#define LOCAL_GOSSIP_QUERIES_EX 10

/* BOLT-531c8d7d9b01ab610b8a73a0deba1b9e9c83e1ed #9:
/* BOLT #9:
* | Bits | Name |...
* | 12/13| `option_static_remotekey` |...
*/
Expand Down
7 changes: 5 additions & 2 deletions common/key_derive.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,21 @@

/* BOLT #3:
*
* ### `localpubkey`, `remotepubkey`, `local_htlcpubkey`, `remote_htlcpubkey`, `local_delayedpubkey`, and `remote_delayedpubkey` Derivation
* ### `localpubkey`, `local_htlcpubkey`, `remote_htlcpubkey`, `local_delayedpubkey`, and `remote_delayedpubkey` Derivation
*
* These pubkeys are simply generated by addition from their base points:
*
* pubkey = basepoint + SHA256(per_commitment_point || basepoint) * G
*
* The `localpubkey` uses the local node's `payment_basepoint`;
* the `remotepubkey` uses the remote node's `payment_basepoint`;
* the `local_htlcpubkey` uses the local node's `htlc_basepoint`;
* the `remote_htlcpubkey` uses the remote node's `htlc_basepoint`;
* the `local_delayedpubkey` uses the local node's `delayed_payment_basepoint`;
* and the `remote_delayedpubkey` uses the remote node's `delayed_payment_basepoint`.
*...
* If `option_static_remotekey` is negotiated the `remotepubkey` is simply the
* remote node's `payment_basepoint`, otherwise it is calculated as above using
* the remote node's `payment_basepoint`.
*/
bool derive_simple_key(const struct pubkey *basepoint,
const struct pubkey *per_commitment_point,
Expand Down
4 changes: 2 additions & 2 deletions common/keyset.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ bool derive_keyset(const struct pubkey *per_commitment_point,
bool option_static_remotekey,
struct keyset *keyset)
{
/* BOLT-531c8d7d9b01ab610b8a73a0deba1b9e9c83e1ed #3:
/* BOLT #3:
*
* ### `localpubkey`, `local_htlcpubkey`, `remote_htlcpubkey`, `local_delayedpubkey`, and `remote_delayedpubkey` Derivation
*
Expand All @@ -27,7 +27,7 @@ bool derive_keyset(const struct pubkey *per_commitment_point,
&keyset->self_payment_key))
return false;

/* BOLT-531c8d7d9b01ab610b8a73a0deba1b9e9c83e1ed #3:
/* BOLT #3:
*
* ### `remotepubkey` Derivation
*
Expand Down
2 changes: 1 addition & 1 deletion hsmd/hsmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ static void hsm_unilateral_close_privkey(struct privkey *dst,
get_channel_seed(&info->peer_id, info->channel_id, &channel_seed);
derive_basepoints(&channel_seed, NULL, &basepoints, &secrets, NULL);

/* BOLT-531c8d7d9b01ab610b8a73a0deba1b9e9c83e1ed #3:
/* BOLT #3:
*
* If `option_static_remotekey` is negotiated the `remotepubkey`
* is simply the remote node's `payment_basepoint`, otherwise it is
Expand Down
3 changes: 0 additions & 3 deletions lightningd/channel_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,6 @@ void peer_start_channeld(struct channel *channel,
num_revocations = revocations_received(&channel->their_shachain.chain);

/* BOLT #2:
*
* - if it supports `option_data_loss_protect`:
*...
* - if `next_revocation_number` equals 0:
* - MUST set `your_last_per_commitment_secret` to all zeroes
* - otherwise:
Expand Down
3 changes: 0 additions & 3 deletions lightningd/closing_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,6 @@ void peer_start_closingd(struct channel *channel,
}

/* BOLT #2:
*
* - if it supports `option_data_loss_protect`:
*...
* - if `next_revocation_number` equals 0:
* - MUST set `your_last_per_commitment_secret` to all zeroes
* - otherwise:
Expand Down
2 changes: 1 addition & 1 deletion lightningd/opening_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ wallet_commit_channel(struct lightningd *ld,
/* old_remote_per_commit not valid yet, copy valid one. */
channel_info->old_remote_per_commit = channel_info->remote_per_commit;

/* BOLT-531c8d7d9b01ab610b8a73a0deba1b9e9c83e1ed #2:
/* BOLT #2:
* 1. type: 35 (`funding_signed`)
* 2. data:
* * [`channel_id`:`channel_id`]
Expand Down
2 changes: 1 addition & 1 deletion onchaind/onchaind.c
Original file line number Diff line number Diff line change
Expand Up @@ -2485,7 +2485,7 @@ static void handle_unknown_commitment(const struct bitcoin_tx *tx,
local_script = scriptpubkey_p2wpkh(tmpctx,
&ks->other_payment_key);
} else {
/* BOLT-531c8d7d9b01ab610b8a73a0deba1b9e9c83e1ed #3:
/* BOLT #3:
*
* ### `remotepubkey` Derivation
*
Expand Down
14 changes: 4 additions & 10 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from fixtures import * # noqa: F401,F403
from flaky import flaky # noqa: F401
from lightning import RpcError
from utils import DEVELOPER, only_one, wait_for, sync_blockheight, VALGRIND, TIMEOUT, SLOW_MACHINE, EXPERIMENTAL_FEATURES
from utils import DEVELOPER, only_one, wait_for, sync_blockheight, VALGRIND, TIMEOUT, SLOW_MACHINE
from bitcoin.core import CMutableTransaction, CMutableTxOut

import binascii
Expand Down Expand Up @@ -1382,9 +1382,7 @@ def test_forget_channel(node_factory):

def test_peerinfo(node_factory, bitcoind):
l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True})
lfeatures = '08a2'
if EXPERIMENTAL_FEATURES:
lfeatures = '28a2'
lfeatures = '28a2'
# Gossiping but no node announcement yet
assert l1.rpc.getpeer(l2.info['id'])['connected']
assert len(l1.rpc.getpeer(l2.info['id'])['channels']) == 0
Expand Down Expand Up @@ -1636,12 +1634,8 @@ def test_dataloss_protection(node_factory, bitcoind):
l2 = node_factory.get_node(may_reconnect=True, log_all_io=True,
feerates=(7500, 7500, 7500), allow_broken_log=True)

if EXPERIMENTAL_FEATURES:
# features 1, 3, 7, 11 and 13 (0x28a2).
lf = "28a2"
else:
# features 1, 3, 7 and 11 (0x08a2).
lf = "08a2"
# features 1, 3, 7, 11 and 13 (0x28a2).
lf = "28a2"
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
# l1 should send out WIRE_INIT (0010)
l1.daemon.wait_for_log(r"\[OUT\] 0010"
Expand Down
7 changes: 3 additions & 4 deletions tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from flaky import flaky # noqa: F401
from lightning import RpcError
from threading import Event
from utils import DEVELOPER, TIMEOUT, VALGRIND, sync_blockheight, only_one, wait_for, TailableProc, EXPERIMENTAL_FEATURES
from utils import DEVELOPER, TIMEOUT, VALGRIND, sync_blockheight, only_one, wait_for, TailableProc
from ephemeral_port_reserve import reserve

import json
Expand Down Expand Up @@ -1446,7 +1446,6 @@ def test_list_features_only(node_factory):
expected = ['option_data_loss_protect/odd',
'option_upfront_shutdown_script/odd',
'option_gossip_queries/odd',
'option_gossip_queries_ex/odd']
if EXPERIMENTAL_FEATURES:
expected += ['option_static_remotekey/odd']
'option_gossip_queries_ex/odd',
'option_static_remotekey/odd']
assert features == expected
12 changes: 0 additions & 12 deletions wire/extracted_peer_experimental_legacy

This file was deleted.

4 changes: 2 additions & 2 deletions wire/extracted_peer_wire_csv
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ msgtype,channel_reestablish,136
msgdata,channel_reestablish,channel_id,channel_id,
msgdata,channel_reestablish,next_commitment_number,u64,
msgdata,channel_reestablish,next_revocation_number,u64,
msgdata,channel_reestablish,your_last_per_commitment_secret,byte,32,option_data_loss_protect
msgdata,channel_reestablish,my_current_per_commitment_point,point,,option_data_loss_protect
msgdata,channel_reestablish,your_last_per_commitment_secret,byte,32,option_data_loss_protect,option_static_remotekey
msgdata,channel_reestablish,my_current_per_commitment_point,point,,option_data_loss_protect,option_static_remotekey
msgtype,announcement_signatures,259
msgdata,announcement_signatures,channel_id,channel_id,
msgdata,announcement_signatures,short_channel_id,short_channel_id,
Expand Down