mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 22:45:27 +01:00
pytest: fix flake in test_feerate_stress.
If randomly l1done or l2done are zero, we will create invalid hex: ``` with pytest.raises(RpcError, match='WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS|WIRE_TEMPORARY_CHANNEL_FAILURE'): > l2.rpc.waitsendpay("{:064x}".format(l2done - 1), timeout=TIMEOUT) tests/test_connection.py:3438: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ contrib/pyln-client/pyln/client/lightning.py:1361: in waitsendpay return self.call("waitsendpay", payload) contrib/pyln-testing/pyln/testing/utils.py:715: in call schemas[0].validate(testpayload) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = Validator(schema={'pairedWith': [['partid', 'groupid']], 'properties': {'groupid': {'description': ['Grouping key...pa... {'description': ['A timeout in... the payment.'], 'type': 'u32'}}, 'required': ['payment_hash']}, format_checker=None) args = ({'payment_hash': '-000000000000000000000000000000000000000000000000000000000000001', 'timeout': 180},) kwargs = {} error = <ValidationError: "'-000000000000000000000000000000000000000000000000000000000000001' is not of type 'hash'"> def validate(self, *args, **kwargs): for error in self.iter_errors(*args, **kwargs): > raise error E jsonschema.exceptions.ValidationError: '-000000000000000000000000000000000000000000000000000000000000001' is not of type 'hash' E E Failed validating 'type' in schema['properties']['payment_hash']: E {'description': ['The hash of the *payment_preimage*.'], 'type': 'hash'} E E On instance['payment_hash']: E '-000000000000000000000000000000000000000000000000000000000000001' ``` Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
fd9975c288
commit
bb64fc8ddc
1 changed files with 6 additions and 4 deletions
|
@ -3432,10 +3432,12 @@ def test_feerate_stress(node_factory, executor):
|
|||
# Make sure it's reconnected, and wait for last payment.
|
||||
wait_for(lambda: l1.rpc.getpeer(l2.info['id'])['connected'])
|
||||
# We can get TEMPORARY_CHANNEL_FAILURE due to disconnect, too.
|
||||
with pytest.raises(RpcError, match='WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS|WIRE_TEMPORARY_CHANNEL_FAILURE'):
|
||||
l1.rpc.waitsendpay("{:064x}".format(l1done - 1), timeout=TIMEOUT)
|
||||
with pytest.raises(RpcError, match='WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS|WIRE_TEMPORARY_CHANNEL_FAILURE'):
|
||||
l2.rpc.waitsendpay("{:064x}".format(l2done - 1), timeout=TIMEOUT)
|
||||
if l1done != 0:
|
||||
with pytest.raises(RpcError, match='WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS|WIRE_TEMPORARY_CHANNEL_FAILURE'):
|
||||
l1.rpc.waitsendpay("{:064x}".format(l1done - 1), timeout=TIMEOUT)
|
||||
if l2done != 0:
|
||||
with pytest.raises(RpcError, match='WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS|WIRE_TEMPORARY_CHANNEL_FAILURE'):
|
||||
l2.rpc.waitsendpay("{:064x}".format(l2done - 1), timeout=TIMEOUT)
|
||||
l1.rpc.call('dev-feerate', [l2.info['id'], rate - 5])
|
||||
assert not l1.daemon.is_in_log('Bad.*signature')
|
||||
assert not l2.daemon.is_in_log('Bad.*signature')
|
||||
|
|
Loading…
Add table
Reference in a new issue