mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-23 06:55:13 +01:00
pytest: don't assume gossip order in test_gossip_query_channel_range
``` # reply_channel_range == 264 > assert msgs == ['0108' # blockhash + genesis_blockhash # first_blocknum, number_of_blocks, complete + format(0, '08x') + format(1000000, '08x') + '01' # encoded_short_ids + format(len(encoded) // 2, '04x') + encoded] E AssertionError: assert ['010806226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f00000000000f42400100110000006900000100000000680000010000'] == ['010806226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f00000000000f42400100110000006800000100000000690000010000'] E At index 0 diff: '010806226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f00000000000f42400100110000006900000100000000680000010000' != '010806226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f00000000000f42400100110000006800000100000000690000010000' E Full diff: E - ['010806226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f00000000000f42400100110000006800000100000000690000010000'] E ? ^ ^ E + ['010806226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910f00000000000f42400100110000006900000100000000680000010000'] E ? ^ ^ ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
a5ba3f8f24
commit
40a4d83764
1 changed files with 60 additions and 29 deletions
|
@ -748,19 +748,32 @@ def test_gossip_query_channel_range(node_factory, bitcoind, chainparams):
|
|||
chainparams['chain_hash'],
|
||||
0, 1000000,
|
||||
filters=['0109', '0107', '0012'])
|
||||
encoded = subprocess.run(['devtools/mkencoded', '--scids', '00', scid12, scid23],
|
||||
check=True,
|
||||
timeout=TIMEOUT,
|
||||
stdout=subprocess.PIPE).stdout.strip().decode()
|
||||
# Either order!
|
||||
encoded1 = subprocess.run(['devtools/mkencoded', '--scids', '00', scid12, scid23],
|
||||
check=True,
|
||||
timeout=TIMEOUT,
|
||||
stdout=subprocess.PIPE).stdout.strip().decode()
|
||||
encoded2 = subprocess.run(['devtools/mkencoded', '--scids', '00', scid23, scid12],
|
||||
check=True,
|
||||
timeout=TIMEOUT,
|
||||
stdout=subprocess.PIPE).stdout.strip().decode()
|
||||
# reply_channel_range == 264
|
||||
assert msgs == ['0108'
|
||||
# blockhash
|
||||
+ genesis_blockhash
|
||||
# first_blocknum, number_of_blocks, complete
|
||||
+ format(0, '08x') + format(1000000, '08x') + '01'
|
||||
# encoded_short_ids
|
||||
+ format(len(encoded) // 2, '04x')
|
||||
+ encoded]
|
||||
assert msgs in (['0108'
|
||||
# blockhash
|
||||
+ genesis_blockhash
|
||||
# first_blocknum, number_of_blocks, complete
|
||||
+ format(0, '08x') + format(1000000, '08x') + '01'
|
||||
# encoded_short_ids
|
||||
+ format(len(encoded1) // 2, '04x')
|
||||
+ encoded1],
|
||||
['0108'
|
||||
# blockhash
|
||||
+ genesis_blockhash
|
||||
# first_blocknum, number_of_blocks, complete
|
||||
+ format(0, '08x') + format(1000000, '08x') + '01'
|
||||
# encoded_short_ids
|
||||
+ format(len(encoded2) // 2, '04x')
|
||||
+ encoded2])
|
||||
|
||||
# Does not include scid12
|
||||
msgs = l4.query_gossip('query_channel_range',
|
||||
|
@ -819,19 +832,32 @@ def test_gossip_query_channel_range(node_factory, bitcoind, chainparams):
|
|||
genesis_blockhash,
|
||||
block12, block23 - block12 + 1,
|
||||
filters=['0109', '0107', '0012'])
|
||||
encoded = subprocess.run(['devtools/mkencoded', '--scids', '00', scid12, scid23],
|
||||
check=True,
|
||||
timeout=TIMEOUT,
|
||||
stdout=subprocess.PIPE).stdout.strip().decode()
|
||||
# Either order
|
||||
encoded1 = subprocess.run(['devtools/mkencoded', '--scids', '00', scid12, scid23],
|
||||
check=True,
|
||||
timeout=TIMEOUT,
|
||||
stdout=subprocess.PIPE).stdout.strip().decode()
|
||||
encoded2 = subprocess.run(['devtools/mkencoded', '--scids', '00', scid23, scid12],
|
||||
check=True,
|
||||
timeout=TIMEOUT,
|
||||
stdout=subprocess.PIPE).stdout.strip().decode()
|
||||
# reply_channel_range == 264
|
||||
assert msgs == ['0108'
|
||||
# blockhash
|
||||
+ genesis_blockhash
|
||||
# first_blocknum, number_of_blocks, complete
|
||||
+ format(block12, '08x') + format(block23 - block12 + 1, '08x') + '01'
|
||||
# encoded_short_ids
|
||||
+ format(len(encoded) // 2, '04x')
|
||||
+ encoded]
|
||||
assert msgs in (['0108'
|
||||
# blockhash
|
||||
+ genesis_blockhash
|
||||
# first_blocknum, number_of_blocks, complete
|
||||
+ format(block12, '08x') + format(block23 - block12 + 1, '08x') + '01'
|
||||
# encoded_short_ids
|
||||
+ format(len(encoded1) // 2, '04x')
|
||||
+ encoded1],
|
||||
['0108'
|
||||
# blockhash
|
||||
+ genesis_blockhash
|
||||
# first_blocknum, number_of_blocks, complete
|
||||
+ format(block12, '08x') + format(block23 - block12 + 1, '08x') + '01'
|
||||
# encoded_short_ids
|
||||
+ format(len(encoded2) // 2, '04x')
|
||||
+ encoded2])
|
||||
|
||||
# Only includes scid23
|
||||
msgs = l4.query_gossip('query_channel_range',
|
||||
|
@ -888,11 +914,16 @@ def test_gossip_query_channel_range(node_factory, bitcoind, chainparams):
|
|||
assert this_start == start
|
||||
start += num
|
||||
|
||||
encoded = subprocess.run(['devtools/mkencoded', '--scids', '00', scid12, scid23],
|
||||
check=True,
|
||||
timeout=TIMEOUT,
|
||||
stdout=subprocess.PIPE).stdout.strip().decode()
|
||||
assert scids == encoded
|
||||
# Either order
|
||||
encoded1 = subprocess.run(['devtools/mkencoded', '--scids', '00', scid12, scid23],
|
||||
check=True,
|
||||
timeout=TIMEOUT,
|
||||
stdout=subprocess.PIPE).stdout.strip().decode()
|
||||
encoded2 = subprocess.run(['devtools/mkencoded', '--scids', '00', scid23, scid12],
|
||||
check=True,
|
||||
timeout=TIMEOUT,
|
||||
stdout=subprocess.PIPE).stdout.strip().decode()
|
||||
assert scids in (encoded1, encoded2)
|
||||
|
||||
# Test overflow case doesn't split forever; should still only get 2 for this
|
||||
msgs = l4.query_gossip('query_channel_range',
|
||||
|
|
Loading…
Add table
Reference in a new issue