Skip to content

Commit 8d60994

Browse files
committed
plugins/sql: add bkpr-listaccountevents and bkpr-listincome support.
This *would* be a 1-line change (add it to Makefile) except that we previously assumed a "list" prefix on commands. These use the default refreshing, but they could be done better using the time-range parameters. Suggested-by: @niftynei Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 212c859 commit 8d60994

File tree

3 files changed

+87
-3
lines changed

3 files changed

+87
-3
lines changed

doc/lightning-sql.7.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,36 @@ TABLES
7979
------
8080
[comment]: # (GENERATE-DOC-START)
8181
The following tables are currently supported:
82+
- `bkpr_accountevents` (see lightning-bkpr-listaccountevents(7))
83+
- `account` (type `string`, sqltype `TEXT`)
84+
- `type` (type `string`, sqltype `TEXT`)
85+
- `tag` (type `string`, sqltype `TEXT`)
86+
- `credit_msat` (type `msat`, sqltype `INTEGER`)
87+
- `debit_msat` (type `msat`, sqltype `INTEGER`)
88+
- `currency` (type `string`, sqltype `TEXT`)
89+
- `timestamp` (type `u32`, sqltype `INTEGER`)
90+
- `outpoint` (type `string`, sqltype `TEXT`)
91+
- `blockheight` (type `u32`, sqltype `INTEGER`)
92+
- `origin` (type `string`, sqltype `TEXT`)
93+
- `payment_id` (type `hex`, sqltype `BLOB`)
94+
- `txid` (type `txid`, sqltype `BLOB`)
95+
- `description` (type `string`, sqltype `TEXT`)
96+
- `fees_msat` (type `msat`, sqltype `INTEGER`)
97+
- `is_rebalance` (type `boolean`, sqltype `INTEGER`)
98+
- `part_id` (type `u32`, sqltype `INTEGER`)
99+
100+
- `bkpr_income` (see lightning-bkpr-listincome(7))
101+
- `account` (type `string`, sqltype `TEXT`)
102+
- `tag` (type `string`, sqltype `TEXT`)
103+
- `credit_msat` (type `msat`, sqltype `INTEGER`)
104+
- `debit_msat` (type `msat`, sqltype `INTEGER`)
105+
- `currency` (type `string`, sqltype `TEXT`)
106+
- `timestamp` (type `u32`, sqltype `INTEGER`)
107+
- `description` (type `string`, sqltype `TEXT`)
108+
- `outpoint` (type `string`, sqltype `TEXT`)
109+
- `txid` (type `txid`, sqltype `BLOB`)
110+
- `payment_id` (type `hex`, sqltype `BLOB`)
111+
82112
- `channels` indexed by `short_channel_id` (see lightning-listchannels(7))
83113
- `source` (type `pubkey`, sqltype `BLOB`)
84114
- `destination` (type `pubkey`, sqltype `BLOB`)
@@ -334,4 +364,4 @@ RESOURCES
334364
---------
335365

336366
Main web site: <https://github.com/ElementsProject/lightning>
337-
[comment]: # ( SHA256STAMP:93309f8c45ea3aa153bfd8822f2748c1254812d41a408de39bacefa292e11374)
367+
[comment]: # ( SHA256STAMP:dbb9286cf31dc82b33143d5274b1c4eecc75c5ba1dfc18bdf21b4baab585bd45)

plugins/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ plugins/fetchinvoice: $(PLUGIN_FETCHINVOICE_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_CO
205205
plugins/funder: bitcoin/psbt.o common/psbt_open.o $(PLUGIN_FUNDER_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_OBJS)
206206

207207
# This covers all the low-level list RPCs which return simple arrays
208-
SQL_LISTRPCS := listchannels listforwards listhtlcs listinvoices listnodes listoffers listpeers listpeerchannels listtransactions listsendpays
208+
SQL_LISTRPCS := listchannels listforwards listhtlcs listinvoices listnodes listoffers listpeers listpeerchannels listtransactions listsendpays bkpr-listaccountevents bkpr-listincome
209209
SQL_LISTRPCS_SCHEMAS := $(foreach l,$(SQL_LISTRPCS),doc/schemas/$l.schema.json)
210210
# We squeeze:
211211
# descriptions (we don't need)

tests/test_plugin.py

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3727,7 +3727,61 @@ def test_sql(node_factory, bitcoind):
37273727
{'name': 'type',
37283728
'type': 'string'},
37293729
{'name': 'channel',
3730-
'type': 'short_channel_id'}]}}
3730+
'type': 'short_channel_id'}]},
3731+
'bkpr_accountevents': {
3732+
'columns': [{'name': 'account',
3733+
'type': 'string'},
3734+
{'name': 'type',
3735+
'type': 'string'},
3736+
{'name': 'tag',
3737+
'type': 'string'},
3738+
{'name': 'credit_msat',
3739+
'type': 'msat'},
3740+
{'name': 'debit_msat',
3741+
'type': 'msat'},
3742+
{'name': 'currency',
3743+
'type': 'string'},
3744+
{'name': 'timestamp',
3745+
'type': 'u32'},
3746+
{'name': 'outpoint',
3747+
'type': 'string'},
3748+
{'name': 'blockheight',
3749+
'type': 'u32'},
3750+
{'name': 'origin',
3751+
'type': 'string'},
3752+
{'name': 'payment_id',
3753+
'type': 'hex'},
3754+
{'name': 'txid',
3755+
'type': 'txid'},
3756+
{'name': 'description',
3757+
'type': 'string'},
3758+
{'name': 'fees_msat',
3759+
'type': 'msat'},
3760+
{'name': 'is_rebalance',
3761+
'type': 'boolean'},
3762+
{'name': 'part_id',
3763+
'type': 'u32'}]},
3764+
'bkpr_income': {
3765+
'columns': [{'name': 'account',
3766+
'type': 'string'},
3767+
{'name': 'tag',
3768+
'type': 'string'},
3769+
{'name': 'credit_msat',
3770+
'type': 'msat'},
3771+
{'name': 'debit_msat',
3772+
'type': 'msat'},
3773+
{'name': 'currency',
3774+
'type': 'string'},
3775+
{'name': 'timestamp',
3776+
'type': 'u32'},
3777+
{'name': 'description',
3778+
'type': 'string'},
3779+
{'name': 'outpoint',
3780+
'type': 'string'},
3781+
{'name': 'txid',
3782+
'type': 'txid'},
3783+
{'name': 'payment_id',
3784+
'type': 'hex'}]}}
37313785

37323786
# Very rough checks of other list commands (make sure l2 has one of each)
37333787
l2.rpc.offer(1, 'desc')

0 commit comments

Comments
 (0)