libplugin: don't spew datastore errors to LOG_DEBUG.

People get upset, especially as our "not found" error can be a bit
hard to read!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
See-also: #5990
This commit is contained in:
Rusty Russell
2023-02-10 14:53:53 +10:30
committed by Alex Myers
parent dd9400df99
commit 70aee52903
6 changed files with 56 additions and 47 deletions

View File

@@ -131,7 +131,7 @@ static const char *init(struct plugin *p,
const char *buf UNUSED,
const jsmntok_t *config UNUSED)
{
const char *name;
const char *name, *err_str, *err_hex;
const u8 *binname;
plugin_log(p, LOG_DBG, "test_libplugin initialised!");
@@ -143,19 +143,21 @@ static const char *init(struct plugin *p,
return "Disabled via selfdisable option";
/* Test rpc_scan_datastore funcs */
if (!rpc_scan_datastore_str(p, "test_libplugin/name",
JSON_SCAN_TAL(tmpctx, json_strdup,
&name)))
err_str = rpc_scan_datastore_str(tmpctx, p, "test_libplugin/name",
JSON_SCAN_TAL(tmpctx, json_strdup,
&name));
if (err_str)
name = NULL;
if (!rpc_scan_datastore_hex(p, "test_libplugin/name",
JSON_SCAN_TAL(tmpctx, json_tok_bin_from_hex,
&binname)))
err_hex = rpc_scan_datastore_hex(tmpctx, p, "test_libplugin/name",
JSON_SCAN_TAL(tmpctx, json_tok_bin_from_hex,
&binname));
if (err_hex)
binname = NULL;
plugin_log(p, LOG_INFORM, "String name from datastore: %s",
name ? name : "NOT FOUND");
name ? name : err_str);
plugin_log(p, LOG_INFORM, "Hex name from datastore: %s",
binname ? tal_hex(tmpctx, binname) : "NOT FOUND");
binname ? tal_hex(tmpctx, binname) : err_hex);
return NULL;
}