Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default args, fix flake #5460

Merged
merged 5 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions lightningd/plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ static const char *plugin_opt_add(struct plugin *plugin, const char *buffer,
if (strchr(popt->name, '|'))
return tal_fmt(plugin, "Option \"name\" may not contain '|'");

popt->description = NULL;
popt->description = json_strdup(popt, buffer, desctok);
if (deptok) {
if (!json_to_bool(buffer, deptok, &popt->deprecated))
return tal_fmt(plugin,
Expand Down Expand Up @@ -981,7 +981,7 @@ static const char *plugin_opt_add(struct plugin *plugin, const char *buffer,
"Only \"string\", \"int\", \"bool\", and \"flag\" options are supported");
}

if (defaulttok) {
if (defaulttok && !json_tok_is_null(buffer, defaulttok)) {
popt->def = plugin_opt_value(popt, popt->type,
json_strdup(tmpctx, buffer, defaulttok));
if (!popt->def)
Expand All @@ -991,8 +991,6 @@ static const char *plugin_opt_add(struct plugin *plugin, const char *buffer,
popt->type);
}

if (!popt->description)
popt->description = json_strdup(popt, buffer, desctok);

list_add_tail(&plugin->plugin_opts, &popt->list);

Expand Down
1 change: 1 addition & 0 deletions plugins/commando.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ static void handle_incmd(struct node_id *peer,
}

try_command(peer, idnum, incmd->contents, tal_bytelen(incmd->contents));
tal_free(incmd);
}

static struct command_result *handle_reply(struct node_id *peer,
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self, *args, **kwargs):
if not has_dblog:
# Add as an expanded option so we don't clobber other options.
self.daemon.opts['plugin={}'.format(dblog)] = None
self.daemon.opts['dblog-file'] = 'dblog.sqlite3'

# Yes, we really want to test the local development version, not
# something in out path.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2203,6 +2203,8 @@ def test_funding_while_offline(node_factory, bitcoind):
@pytest.mark.developer
@pytest.mark.openchannel('v1')
@pytest.mark.openchannel('v2')
@unittest.skipIf(os.environ.get("TEST_CHECK_DBSTMTS", None) == "1",
"We kill l2, dblog plugin replay will be unreliable")
def test_channel_persistence(node_factory, bitcoind, executor):
# Start two nodes and open a channel (to remember). l2 will
# mysteriously die while committing the first HTLC so we can
Expand Down
8 changes: 6 additions & 2 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2835,8 +2835,12 @@ def test_commando_stress(node_factory, executor):
assert(e.error['message'] == "Invalid JSON")
discards += 1

# Should have exactly one discard msg from each discard
nodes[0].daemon.wait_for_logs([r"New cmd from .*, replacing old"] * discards)
# Should have at least one discard msg from each failure (we can have
# more, if they kept replacing each other, as happens!)
if discards > 0:
nodes[0].daemon.wait_for_logs([r"New cmd from .*, replacing old"] * discards)
else:
assert not nodes[0].daemon.is_in_log(r"New cmd from .*, replacing old")


def test_commando_badrune(node_factory):
Expand Down