Skip to content

Commit b7a6287

Browse files
committed
sql: add support for listnetworkevents
Signed-off-by: Rusty Russell <[email protected]> Changelog-Added: JSON-RPC: `sql` now supports the `networkevents` table.
1 parent ff3a0ad commit b7a6287

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

plugins/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ plugins/recover: common/gossmap.o common/sciddir_or_pubkey.o common/fp16.o $(PL
256256
plugins/recklessrpc: $(PLUGIN_RECKLESSRPC_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
257257

258258
# This covers all the low-level list RPCs which return simple arrays
259-
SQL_LISTRPCS := listchannels listforwards listhtlcs listinvoices listnodes listoffers listpeers listpeerchannels listclosedchannels listtransactions listsendpays listchainmoves listchannelmoves bkpr-listaccountevents bkpr-listincome
259+
SQL_LISTRPCS := listchannels listforwards listhtlcs listinvoices listnodes listoffers listpeers listpeerchannels listclosedchannels listtransactions listsendpays listchainmoves listchannelmoves bkpr-listaccountevents bkpr-listincome listnetworkevents
260260
SQL_LISTRPCS_SCHEMAS := $(foreach l,$(SQL_LISTRPCS),doc/schemas/$l.json)
261261
SQL_SCHEMA_PARTS := $(foreach l,$(SQL_LISTRPCS), plugins/sql-schema_$l_gen.h)
262262

plugins/sql.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1487,7 +1487,8 @@ static const struct refresh_funcs refresh_funcs[] = {
14871487
{ "listclosedchannels", default_refresh },
14881488
{ "listtransactions", default_refresh },
14891489
{ "bkpr-listaccountevents", default_refresh },
1490-
{ "bkpr-listincome", default_refresh }
1490+
{ "bkpr-listincome", default_refresh },
1491+
{ "listnetworkevents", default_refresh },
14911492
};
14921493

14931494
static const struct refresh_funcs *find_command_refresh(const char *cmdname)

tests/test_plugin.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3869,7 +3869,21 @@ def test_sql(node_factory, bitcoind):
38693869
{'name': 'txid',
38703870
'type': 'txid'},
38713871
{'name': 'payment_id',
3872-
'type': 'hex'}]}}
3872+
'type': 'hex'}]},
3873+
'networkevents': {
3874+
'columns': [{'name': 'created_index',
3875+
'type': 'u64'},
3876+
{'name': 'timestamp',
3877+
'type': 'u64'},
3878+
{'name': 'peer_id',
3879+
'type': 'pubkey'},
3880+
{'name': 'type',
3881+
'type': 'string'},
3882+
{'name': 'reason',
3883+
'type': 'string'},
3884+
{'name': 'duration_nsec',
3885+
'type': 'u64'}]},
3886+
}
38733887

38743888
sqltypemap = {'string': 'TEXT',
38753889
'boolean': 'INTEGER',

0 commit comments

Comments
 (0)