mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-22 08:34:20 +01:00
lightningd: make invoices insist on payment_secret.
In fact, we make it compulsory, which means if you don't understand it you'll hang up on us! Add some logging for that in future. Changelog-Changed: Protocol: All new invoices require a payment_secret (i.e. modern TLV format onion) Changelog-Changed: Protocol: We can no longer connect to peers which don't support `payment_secret`. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
8f86b45f26
commit
9eb531868f
@@ -479,6 +479,7 @@ struct io_plan *peer_connected(struct io_conn *conn,
|
|||||||
unsup = features_unsupported(daemon->our_features, their_features,
|
unsup = features_unsupported(daemon->our_features, their_features,
|
||||||
INIT_FEATURE);
|
INIT_FEATURE);
|
||||||
if (unsup != -1) {
|
if (unsup != -1) {
|
||||||
|
status_peer_unusual(id, "Unsupported feature %u", unsup);
|
||||||
msg = towire_warningfmt(NULL, NULL, "Unsupported feature %u",
|
msg = towire_warningfmt(NULL, NULL, "Unsupported feature %u",
|
||||||
unsup);
|
unsup);
|
||||||
msg = cryptomsg_encrypt_msg(tmpctx, cs, take(msg));
|
msg = cryptomsg_encrypt_msg(tmpctx, cs, take(msg));
|
||||||
@@ -486,6 +487,8 @@ struct io_plan *peer_connected(struct io_conn *conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!feature_check_depends(their_features, &depender, &missing)) {
|
if (!feature_check_depends(their_features, &depender, &missing)) {
|
||||||
|
status_peer_unusual(id, "Feature %zu requires feature %zu",
|
||||||
|
depender, missing);
|
||||||
msg = towire_warningfmt(NULL, NULL,
|
msg = towire_warningfmt(NULL, NULL,
|
||||||
"Feature %zu requires feature %zu",
|
"Feature %zu requires feature %zu",
|
||||||
depender, missing);
|
depender, missing);
|
||||||
|
|||||||
@@ -811,7 +811,7 @@ static struct feature_set *default_features(const tal_t *ctx)
|
|||||||
OPTIONAL_FEATURE(OPT_UPFRONT_SHUTDOWN_SCRIPT),
|
OPTIONAL_FEATURE(OPT_UPFRONT_SHUTDOWN_SCRIPT),
|
||||||
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES),
|
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES),
|
||||||
OPTIONAL_FEATURE(OPT_VAR_ONION),
|
OPTIONAL_FEATURE(OPT_VAR_ONION),
|
||||||
OPTIONAL_FEATURE(OPT_PAYMENT_SECRET),
|
COMPULSORY_FEATURE(OPT_PAYMENT_SECRET),
|
||||||
OPTIONAL_FEATURE(OPT_BASIC_MPP),
|
OPTIONAL_FEATURE(OPT_BASIC_MPP),
|
||||||
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES_EX),
|
OPTIONAL_FEATURE(OPT_GOSSIP_QUERIES_EX),
|
||||||
OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY),
|
OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY),
|
||||||
|
|||||||
@@ -3376,7 +3376,9 @@ def test_nonstatic_channel(node_factory, bitcoind):
|
|||||||
"""Smoke test for a channel without option_static_remotekey"""
|
"""Smoke test for a channel without option_static_remotekey"""
|
||||||
l1, l2 = node_factory.line_graph(2,
|
l1, l2 = node_factory.line_graph(2,
|
||||||
opts=[{},
|
opts=[{},
|
||||||
{'dev-force-features': '////'}])
|
# needs at least 15 to connect
|
||||||
|
# (and 9 is a dependent)
|
||||||
|
{'dev-force-features': '9,15////'}])
|
||||||
chan = only_one(only_one(l1.rpc.listpeers()['peers'])['channels'])
|
chan = only_one(only_one(l1.rpc.listpeers()['peers'])['channels'])
|
||||||
assert 'option_static_remotekey' not in chan['features']
|
assert 'option_static_remotekey' not in chan['features']
|
||||||
assert 'option_anchor_outputs' not in chan['features']
|
assert 'option_anchor_outputs' not in chan['features']
|
||||||
|
|||||||
@@ -1893,7 +1893,7 @@ def test_list_features_only(node_factory):
|
|||||||
'option_var_onion_optin/odd',
|
'option_var_onion_optin/odd',
|
||||||
'option_gossip_queries_ex/odd',
|
'option_gossip_queries_ex/odd',
|
||||||
'option_static_remotekey/odd',
|
'option_static_remotekey/odd',
|
||||||
'option_payment_secret/odd',
|
'option_payment_secret/even',
|
||||||
'option_basic_mpp/odd',
|
'option_basic_mpp/odd',
|
||||||
]
|
]
|
||||||
if EXPERIMENTAL_FEATURES:
|
if EXPERIMENTAL_FEATURES:
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ def hex_bits(features):
|
|||||||
|
|
||||||
def expected_peer_features(wumbo_channels=False, extra=[]):
|
def expected_peer_features(wumbo_channels=False, extra=[]):
|
||||||
"""Return the expected peer features hexstring for this configuration"""
|
"""Return the expected peer features hexstring for this configuration"""
|
||||||
features = [1, 5, 7, 9, 11, 13, 15, 17, 27]
|
features = [1, 5, 7, 9, 11, 13, 14, 17, 27]
|
||||||
if EXPERIMENTAL_FEATURES:
|
if EXPERIMENTAL_FEATURES:
|
||||||
# OPT_ONION_MESSAGES
|
# OPT_ONION_MESSAGES
|
||||||
features += [39]
|
features += [39]
|
||||||
@@ -40,7 +40,7 @@ def expected_peer_features(wumbo_channels=False, extra=[]):
|
|||||||
# features for the 'node' and the 'peer' feature sets
|
# features for the 'node' and the 'peer' feature sets
|
||||||
def expected_node_features(wumbo_channels=False, extra=[]):
|
def expected_node_features(wumbo_channels=False, extra=[]):
|
||||||
"""Return the expected node features hexstring for this configuration"""
|
"""Return the expected node features hexstring for this configuration"""
|
||||||
features = [1, 5, 7, 9, 11, 13, 15, 17, 27, 55]
|
features = [1, 5, 7, 9, 11, 13, 14, 17, 27, 55]
|
||||||
if EXPERIMENTAL_FEATURES:
|
if EXPERIMENTAL_FEATURES:
|
||||||
# OPT_ONION_MESSAGES
|
# OPT_ONION_MESSAGES
|
||||||
features += [39]
|
features += [39]
|
||||||
|
|||||||
Reference in New Issue
Block a user