From ba9daa468d9a38bc0ad599a0589290e0f7c42a47 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 20 Mar 2024 10:16:29 +1030 Subject: [PATCH] ccan: update to get rune error message fix. Signed-off-by: Rusty Russell --- ccan/README | 2 +- ccan/ccan/rune/rune.c | 4 ++++ tests/test_plugin.py | 6 +++--- tests/test_runes.py | 1 - 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ccan/README b/ccan/README index ba6234ee1..85dbcc73c 100644 --- a/ccan/README +++ b/ccan/README @@ -1,3 +1,3 @@ CCAN imported from http://ccodearchive.net. -CCAN version: init-2577-g1ae4c432 +CCAN version: init-2578-g29e55f74 diff --git a/ccan/ccan/rune/rune.c b/ccan/ccan/rune/rune.c index 84296c66b..efbd8c49e 100644 --- a/ccan/ccan/rune/rune.c +++ b/ccan/ccan/rune/rune.c @@ -345,6 +345,8 @@ static const char *rune_alt_single(const tal_t *ctx, memmem(fieldval_str, fieldval_strlen, alt->value, strlen(alt->value))); case RUNE_COND_INT_LESS: + if (!fieldval_str && !fieldval_int) + return tal_fmt(ctx, "%s not present", alt->fieldname); err = integer_compare_valid(ctx, fieldval_int, alt, &runeval_int); if (err) @@ -352,6 +354,8 @@ static const char *rune_alt_single(const tal_t *ctx, return cond_test(ctx, alt, "is greater or equal to", *fieldval_int < runeval_int); case RUNE_COND_INT_GREATER: + if (!fieldval_str && !fieldval_int) + return tal_fmt(ctx, "%s not present", alt->fieldname); err = integer_compare_valid(ctx, fieldval_int, alt, &runeval_int); if (err) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index d12a806be..532b3adce 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -2939,21 +2939,21 @@ def test_commando_rune_pay_amount(node_factory): inv2 = l2.rpc.invoice(amount_msat='any', label='inv2', description='description2')['bolt11'] # Rune requires amount_msat! - with pytest.raises(RpcError, match='Invalid rune: Not permitted: pnameamountmsat is not an integer field'): + with pytest.raises(RpcError, match='Invalid rune: Not permitted: pnameamountmsat not present'): l2.rpc.commando(peer_id=l1.info['id'], rune=rune, method='pay', params={'bolt11': inv1}) # As a named parameter! - with pytest.raises(RpcError, match='Invalid rune: Not permitted: pnameamountmsat is not an integer field'): + with pytest.raises(RpcError, match='Invalid rune: Not permitted: pnameamountmsat not present'): l2.rpc.commando(peer_id=l1.info['id'], rune=rune, method='pay', params=[inv1]) # Can't get around it this way! - with pytest.raises(RpcError, match='Invalid rune: Not permitted: pnameamountmsat is not an integer field'): + with pytest.raises(RpcError, match='Invalid rune: Not permitted: pnameamountmsat not present'): l2.rpc.commando(peer_id=l1.info['id'], rune=rune, method='pay', diff --git a/tests/test_runes.py b/tests/test_runes.py index e865e6a96..b7d297f3b 100644 --- a/tests/test_runes.py +++ b/tests/test_runes.py @@ -448,7 +448,6 @@ def test_checkrune(node_factory): assert exc_info.value.error['code'] == 0x5de -@pytest.mark.xfail(strict=True) def test_rune_pay_amount(node_factory): l1, l2 = node_factory.line_graph(2)