Skip to content

Commit e9bd477

Browse files
rustyrussellendothermicdev
authored andcommitted
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 ec156ae commit e9bd477

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
@@ -1517,7 +1517,8 @@ static const struct refresh_funcs refresh_funcs[] = {
15171517
{ "listclosedchannels", default_refresh },
15181518
{ "listtransactions", default_refresh },
15191519
{ "bkpr-listaccountevents", default_refresh },
1520-
{ "bkpr-listincome", default_refresh }
1520+
{ "bkpr-listincome", default_refresh },
1521+
{ "listnetworkevents", default_refresh },
15211522
};
15221523

15231524
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
@@ -3907,7 +3907,23 @@ def test_sql(node_factory, bitcoind):
39073907
{'name': 'txid',
39083908
'type': 'txid'},
39093909
{'name': 'payment_id',
3910-
'type': 'hex'}]}}
3910+
'type': 'hex'}]},
3911+
'networkevents': {
3912+
'columns': [{'name': 'created_index',
3913+
'type': 'u64'},
3914+
{'name': 'timestamp',
3915+
'type': 'u64'},
3916+
{'name': 'peer_id',
3917+
'type': 'pubkey'},
3918+
{'name': 'type',
3919+
'type': 'string'},
3920+
{'name': 'reason',
3921+
'type': 'string'},
3922+
{'name': 'duration_nsec',
3923+
'type': 'u64'},
3924+
{'name': 'connect_attempted',
3925+
'type': 'boolean'}]},
3926+
}
39113927

39123928
sqltypemap = {'string': 'TEXT',
39133929
'boolean': 'INTEGER',

0 commit comments

Comments
 (0)