mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
commando: integer command parameters can be compared with < and >.
Previously any attempt would result in "is not an integer field"; we now recognize valid JSON integers as integer fields. Changelog-Fixed: Plugins: `commando` runes can now compare integer parameters using '<' and '>' as expected. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
0f72542967
commit
33be5c8d80
@ -427,6 +427,18 @@ static const char *check_condition(const tal_t *ctx,
|
||||
if (!ptok)
|
||||
return rune_alt_single_missing(ctx, alt);
|
||||
|
||||
/* Pass through valid integers as integers. */
|
||||
if (ptok->type == JSMN_PRIMITIVE) {
|
||||
s64 val;
|
||||
|
||||
if (json_to_s64(cinfo->buf, ptok, &val)) {
|
||||
plugin_log(plugin, LOG_DBG, "It's an int %"PRId64, val);
|
||||
return rune_alt_single_int(ctx, alt, val);
|
||||
}
|
||||
|
||||
/* Otherwise, treat it as a string (< and > will fail with
|
||||
* "is not an integer field") */
|
||||
}
|
||||
return rune_alt_single_str(ctx, alt,
|
||||
cinfo->buf + ptok->start,
|
||||
ptok->end - ptok->start);
|
||||
|
@ -2991,7 +2991,6 @@ def test_commando_listrunes(node_factory):
|
||||
assert not_our_rune['our_rune'] is False
|
||||
|
||||
|
||||
@pytest.mark.xfail(strict=True)
|
||||
def test_commando_rune_pay_amount(node_factory):
|
||||
l1, l2 = node_factory.line_graph(2)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user