plugins/sql: add listchainmoves and listchannelmoves.

And note the other commands in See Also section.

Note that this means handling the "outpoint" type.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `sql` plugin now supports `chainmoves` and `channelmoves` tables.
This commit is contained in:
Rusty Russell
2025-08-19 10:30:46 +09:30
parent 6c626b124b
commit cfbca30b7f
6 changed files with 115 additions and 1 deletions

View File

@@ -51,6 +51,7 @@ enum fieldtype {
FIELD_NUMBER,
FIELD_STRING,
FIELD_SCID,
FIELD_OUTPOINT,
};
struct fieldtypemap {
@@ -74,6 +75,7 @@ static const struct fieldtypemap fieldtypemap[] = {
{ "number", "REAL" }, /* FIELD_NUMBER */
{ "string", "TEXT" }, /* FIELD_STRING */
{ "short_channel_id", "TEXT" }, /* FIELD_SCID */
{ "outpoint", "TEXT" }, /* FIELD_OUTPOINT */
};
struct column {
@@ -171,6 +173,14 @@ static const struct index indices[] = {
"transactions",
{ "hash", NULL },
},
{
"chainmoves",
{ "account_id", NULL },
},
{
"channelmoves",
{ "account_id", NULL },
},
};
static enum fieldtype find_fieldtype(const jsmntok_t *name)
@@ -626,6 +636,7 @@ static struct command_result *process_json_obj(struct command *cmd,
break;
case FIELD_SCID:
case FIELD_STRING:
case FIELD_OUTPOINT:
sqlite3_bind_text(stmt, (*sqloff)++, buf + coltok->start,
coltok->end - coltok->start,
SQLITE_STATIC);