mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
pytest: fix feature mask for EXPERIMENTAL_FEATURES, add wumbo support.
There are various places where our tests failed with --enable-expimental-features. And our plugin test overlapped an existing feature. We make our expected_feature functions more generic, and use them everywhere. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
neil saitug
parent
0b89664076
commit
f4f8a363dd
@@ -1,32 +1,54 @@
|
||||
from pyln.testing.utils import TEST_NETWORK, SLOW_MACHINE, TIMEOUT, VALGRIND, DEVELOPER, DEPRECATED_APIS # noqa: F401
|
||||
from pyln.testing.utils import env, only_one, wait_for, write_config, TailableProc, sync_blockheight, wait_channel_quiescent, get_tx_p2wsh_outnum # noqa: F401
|
||||
|
||||
import bitstring
|
||||
|
||||
EXPERIMENTAL_FEATURES = env("EXPERIMENTAL_FEATURES", "0") == "1"
|
||||
COMPAT = env("COMPAT", "1") == "1"
|
||||
|
||||
|
||||
def expected_peer_features():
|
||||
def hex_bits(features):
|
||||
# We always to full bytes
|
||||
flen = (max(features + [0]) + 7) // 8 * 8
|
||||
res = bitstring.BitArray(length=flen)
|
||||
# Big endian sucketh.
|
||||
for f in features:
|
||||
res[flen - 1 - f] = 1
|
||||
return res.hex
|
||||
|
||||
|
||||
def expected_peer_features(wumbo_channels=False, extra=[]):
|
||||
"""Return the expected peer features hexstring for this configuration"""
|
||||
# features 1, 3, 7, 9, 11, 13, 15 and 17 (0x02aaa2).
|
||||
return "02aaa2"
|
||||
features = [1, 5, 7, 9, 11, 13, 15, 17]
|
||||
if EXPERIMENTAL_FEATURES:
|
||||
# OPT_ONION_MESSAGES
|
||||
features += [103]
|
||||
if wumbo_channels:
|
||||
features += [19]
|
||||
return hex_bits(features + extra)
|
||||
|
||||
|
||||
# With the addition of the keysend plugin, we now send a different set of
|
||||
# features for the 'node' and the 'peer' feature sets
|
||||
def expected_node_features():
|
||||
def expected_node_features(wumbo_channels=False, extra=[]):
|
||||
"""Return the expected node features hexstring for this configuration"""
|
||||
# features 1, 3, 7, 9, 11, 13, 15, 17 and 55 (0x8000000002aaa2).
|
||||
return "8000000002aaa2"
|
||||
|
||||
|
||||
def expected_channel_features():
|
||||
"""Return the expected channel features hexstring for this configuration"""
|
||||
# experimental OPT_ONION_MESSAGES
|
||||
features = [1, 5, 7, 9, 11, 13, 15, 17, 55]
|
||||
if EXPERIMENTAL_FEATURES:
|
||||
return '80000000000000000000000000'
|
||||
else:
|
||||
return ''
|
||||
# OPT_ONION_MESSAGES
|
||||
features += [103]
|
||||
if wumbo_channels:
|
||||
features += [19]
|
||||
return hex_bits(features + extra)
|
||||
|
||||
|
||||
def expected_channel_features(wumbo_channels=False, extra=[]):
|
||||
"""Return the expected channel features hexstring for this configuration"""
|
||||
features = []
|
||||
if EXPERIMENTAL_FEATURES:
|
||||
# OPT_ONION_MESSAGES
|
||||
features += [103]
|
||||
if wumbo_channels:
|
||||
features += [19]
|
||||
return hex_bits(features + extra)
|
||||
|
||||
|
||||
def check_coin_moves(n, account_id, expected_moves):
|
||||
|
||||
Reference in New Issue
Block a user