Skip to content

Commit 2050e13

Browse files
committed
sql: add support for listnetworkevents
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Added: JSON-RPC: `sql` now supports the `networkevents` table.
1 parent 17ccd50 commit 2050e13

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

plugins/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ plugins/recover: $(PLUGIN_RECOVER_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a
203203
plugins/recklessrpc: $(PLUGIN_RECKLESSRPC_OBJS) $(PLUGIN_LIB_OBJS) libcommon.a
204204

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

plugins/sql.c

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

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

tests/test_plugin.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3890,7 +3890,23 @@ def test_sql(node_factory, bitcoind):
38903890
{'name': 'txid',
38913891
'type': 'txid'},
38923892
{'name': 'payment_id',
3893-
'type': 'hex'}]}}
3893+
'type': 'hex'}]},
3894+
'networkevents': {
3895+
'columns': [{'name': 'created_index',
3896+
'type': 'u64'},
3897+
{'name': 'timestamp',
3898+
'type': 'u64'},
3899+
{'name': 'peer_id',
3900+
'type': 'pubkey'},
3901+
{'name': 'type',
3902+
'type': 'string'},
3903+
{'name': 'reason',
3904+
'type': 'string'},
3905+
{'name': 'duration_nsec',
3906+
'type': 'u64'},
3907+
{'name': 'connect_attempted',
3908+
'type': 'boolean'}]},
3909+
}
38943910

38953911
sqltypemap = {'string': 'TEXT',
38963912
'boolean': 'INTEGER',

0 commit comments

Comments
 (0)