mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-18 05:12:45 +01:00
common/features: if EXPERIMENTAL_FEATURES, advertise option_static_remotekey
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
ded8eb7b31
commit
5203847025
@ -10,7 +10,8 @@ static const u32 our_localfeatures[] = {
|
|||||||
OPTIONAL_FEATURE(LOCAL_UPFRONT_SHUTDOWN_SCRIPT),
|
OPTIONAL_FEATURE(LOCAL_UPFRONT_SHUTDOWN_SCRIPT),
|
||||||
OPTIONAL_FEATURE(LOCAL_GOSSIP_QUERIES),
|
OPTIONAL_FEATURE(LOCAL_GOSSIP_QUERIES),
|
||||||
#if EXPERIMENTAL_FEATURES
|
#if EXPERIMENTAL_FEATURES
|
||||||
OPTIONAL_FEATURE(LOCAL_GOSSIP_QUERIES_EX)
|
OPTIONAL_FEATURE(LOCAL_GOSSIP_QUERIES_EX),
|
||||||
|
OPTIONAL_FEATURE(LOCAL_STATIC_REMOTEKEY),
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ const char **list_supported_features(const tal_t *ctx);
|
|||||||
bool feature_is_set(const u8 *features, size_t bit);
|
bool feature_is_set(const u8 *features, size_t bit);
|
||||||
void set_feature_bit(u8 **ptr, u32 bit);
|
void set_feature_bit(u8 **ptr, u32 bit);
|
||||||
|
|
||||||
/* BOLT #9:
|
/* BOLT-930a9b44076a8f25a8626b31b3d5a55c0888308c #9:
|
||||||
*
|
*
|
||||||
* Flags are numbered from the least-significant bit, at bit 0 (i.e. 0x1,
|
* Flags are numbered from the least-significant bit, at bit 0 (i.e. 0x1,
|
||||||
* an _even_ bit). They are generally assigned in pairs so that features
|
* an _even_ bit). They are generally assigned in pairs so that features
|
||||||
@ -36,7 +36,7 @@ void set_feature_bit(u8 **ptr, u32 bit);
|
|||||||
#define COMPULSORY_FEATURE(x) ((x) & 0xFFFFFFFE)
|
#define COMPULSORY_FEATURE(x) ((x) & 0xFFFFFFFE)
|
||||||
#define OPTIONAL_FEATURE(x) ((x) | 1)
|
#define OPTIONAL_FEATURE(x) ((x) | 1)
|
||||||
|
|
||||||
/* BOLT #9:
|
/* BOLT-930a9b44076a8f25a8626b31b3d5a55c0888308c #9:
|
||||||
*
|
*
|
||||||
* ## Assigned `localfeatures` flags
|
* ## Assigned `localfeatures` flags
|
||||||
*...
|
*...
|
||||||
@ -45,11 +45,13 @@ void set_feature_bit(u8 **ptr, u32 bit);
|
|||||||
* | 3 | `initial_routing_sync` |...
|
* | 3 | `initial_routing_sync` |...
|
||||||
* | 4/5 | `option_upfront_shutdown_script` |...
|
* | 4/5 | `option_upfront_shutdown_script` |...
|
||||||
* | 6/7 | `gossip_queries` |...
|
* | 6/7 | `gossip_queries` |...
|
||||||
|
* | 48/49| `option_static_remotekey` |...
|
||||||
*/
|
*/
|
||||||
#define LOCAL_DATA_LOSS_PROTECT 0
|
#define LOCAL_DATA_LOSS_PROTECT 0
|
||||||
#define LOCAL_INITIAL_ROUTING_SYNC 2
|
#define LOCAL_INITIAL_ROUTING_SYNC 2
|
||||||
#define LOCAL_UPFRONT_SHUTDOWN_SCRIPT 4
|
#define LOCAL_UPFRONT_SHUTDOWN_SCRIPT 4
|
||||||
#define LOCAL_GOSSIP_QUERIES 6
|
#define LOCAL_GOSSIP_QUERIES 6
|
||||||
|
#define LOCAL_STATIC_REMOTEKEY 48
|
||||||
|
|
||||||
/* BOLT-927c96daab2338b716708a57cd75c84a2d169e0e #9:
|
/* BOLT-927c96daab2338b716708a57cd75c84a2d169e0e #9:
|
||||||
* | Bits | Name |...
|
* | Bits | Name |...
|
||||||
|
@ -1345,7 +1345,7 @@ def test_peerinfo(node_factory, bitcoind):
|
|||||||
l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True})
|
l1, l2 = node_factory.line_graph(2, fundchannel=False, opts={'may_reconnect': True})
|
||||||
lfeatures = 'aa'
|
lfeatures = 'aa'
|
||||||
if EXPERIMENTAL_FEATURES:
|
if EXPERIMENTAL_FEATURES:
|
||||||
lfeatures = '08aa'
|
lfeatures = '020000000008aa'
|
||||||
# Gossiping but no node announcement yet
|
# Gossiping but no node announcement yet
|
||||||
assert l1.rpc.getpeer(l2.info['id'])['connected']
|
assert l1.rpc.getpeer(l2.info['id'])['connected']
|
||||||
assert len(l1.rpc.getpeer(l2.info['id'])['channels']) == 0
|
assert len(l1.rpc.getpeer(l2.info['id'])['channels']) == 0
|
||||||
@ -1596,16 +1596,18 @@ def test_dataloss_protection(node_factory, bitcoind):
|
|||||||
feerates=(7500, 7500, 7500), allow_broken_log=True)
|
feerates=(7500, 7500, 7500), allow_broken_log=True)
|
||||||
|
|
||||||
if EXPERIMENTAL_FEATURES:
|
if EXPERIMENTAL_FEATURES:
|
||||||
# lflen == 2, features 1, 3, 5, 7 and 11 (0x08aa).
|
# features 1, 3, 5, 7, 11 and 49 (0x020000000008aa).
|
||||||
lf = "0002" + "08aa"
|
lf = "020000000008aa"
|
||||||
else:
|
else:
|
||||||
# lflen == 1, features 1, 3, 5 and 7 (0xaa).
|
# features 1, 3, 5 and 7 (0xaa).
|
||||||
lf = "0001" + "aa"
|
lf = "aa"
|
||||||
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
l1.rpc.connect(l2.info['id'], 'localhost', l2.port)
|
||||||
# l1 should send out WIRE_INIT (0010)
|
# l1 should send out WIRE_INIT (0010)
|
||||||
l1.daemon.wait_for_log(r"\[OUT\] 0010"
|
l1.daemon.wait_for_log(r"\[OUT\] 0010"
|
||||||
# gflen == 0
|
# gflen == 0
|
||||||
"0000"
|
"0000"
|
||||||
|
# lflen
|
||||||
|
+ format(len(lf) // 2, '04x')
|
||||||
+ lf)
|
+ lf)
|
||||||
|
|
||||||
l1.fund_channel(l2, 10**6)
|
l1.fund_channel(l2, 10**6)
|
||||||
|
Loading…
Reference in New Issue
Block a user