cln/plugins
Rusty Russell 3ae222540b plugins/sql: use created_index as primary key, where available.
It's a unique integer, and very useful for querying changes.  Unlike
our generated rowid, it's *stable* across queries.

We still need an explicit rowid column for list commands which don't
(currently) have this.

Here's the documentation diff:

    @@ -85,69 +85,69 @@
     TABLES
     ------
     
    -Note that the first column of every table is a unique integer called `rowid`: this is used for related tables to refer to specific rows in their parent. sqlite3 usually has this as an implicit column, but we make it explicit as the implicit version is not allowed to be used as a foreign key.
    +Note that tables which have a `created_index` field use that as the primary key (and `rowid` is an alias to this), otherwise an explicit `rowid` integer primary key is generated, whose value changes on each refresh.  This field is used for related tables to refer to specific rows in their parent. (sqlite3 usually has this as an implicit column, but we make it explicit as the implicit version is not allowed to be used as a foreign key).
     
     The following tables are currently supported:
     - `bkpr_accountevents` (see lightning-bkpr-listaccountevents(7))
    @@ -119,14 +119,14 @@
       - `payment_id` (type `hex`, sqltype `BLOB`)
     
     - `chainmoves` indexed by `account_id` (see lightning-listchainmoves(7))
    -  - `created_index` (type `u64`, sqltype `INTEGER`)
    +  - `created_index` (type `u64`, sqltype `INTEGER PRIMARY KEY`)
       - `account_id` (type `string`, sqltype `TEXT`)
       - `credit_msat` (type `msat`, sqltype `INTEGER`)
       - `debit_msat` (type `msat`, sqltype `INTEGER`)
       - `timestamp` (type `u64`, sqltype `INTEGER`)
       - `primary_tag` (type `string`, sqltype `TEXT`)
       - related table `chainmoves_extra_tags`
    -    - `row` (reference to `chainmoves.rowid`, sqltype `INTEGER`)
    +    - `row` (reference to `chainmoves.created_index`, sqltype `INTEGER`)
         - `arrindex` (index within array, sqltype `INTEGER`)
         - `extra_tags` (type `string`, sqltype `TEXT`)
       - `peer_id` (type `pubkey`, sqltype `BLOB`)
    @@ -139,7 +139,7 @@
       - `blockheight` (type `u32`, sqltype `INTEGER`)
     
     - `channelmoves` indexed by `account_id` (see lightning-listchannelmoves(7))
    -  - `created_index` (type `u64`, sqltype `INTEGER`)
    +  - `created_index` (type `u64`, sqltype `INTEGER PRIMARY KEY`)
       - `account_id` (type `string`, sqltype `TEXT`)
       - `credit_msat` (type `msat`, sqltype `INTEGER`)
       - `debit_msat` (type `msat`, sqltype `INTEGER`)
    @@ -204,7 +204,7 @@
       - `last_stable_connection` (type `u64`, sqltype `INTEGER`)
     
     - `forwards` indexed by `in_channel` and `in_htlc_id` (see lightning-listforwards(7))
    -  - `created_index` (type `u64`, sqltype `INTEGER`)
    +  - `created_index` (type `u64`, sqltype `INTEGER PRIMARY KEY`)
       - `in_channel` (type `short_channel_id`, sqltype `TEXT`)
       - `in_htlc_id` (type `u64`, sqltype `INTEGER`)
       - `in_msat` (type `msat`, sqltype `INTEGER`)
    @@ -222,7 +222,7 @@
     
     - `htlcs` indexed by `short_channel_id` and `id` (see lightning-listhtlcs(7))
       - `short_channel_id` (type `short_channel_id`, sqltype `TEXT`)
    -  - `created_index` (type `u64`, sqltype `INTEGER`)
    +  - `created_index` (type `u64`, sqltype `INTEGER PRIMARY KEY`)
       - `updated_index` (type `u64`, sqltype `INTEGER`)
       - `id` (type `u64`, sqltype `INTEGER`)
       - `expiry` (type `u32`, sqltype `INTEGER`)
    @@ -242,7 +242,7 @@
       - `bolt12` (type `string`, sqltype `TEXT`)
       - `local_offer_id` (type `hash`, sqltype `BLOB`)
       - `invreq_payer_note` (type `string`, sqltype `TEXT`)
    -  - `created_index` (type `u64`, sqltype `INTEGER`)
    +  - `created_index` (type `u64`, sqltype `INTEGER PRIMARY KEY`)
       - `updated_index` (type `u64`, sqltype `INTEGER`)
       - `pay_index` (type `u64`, sqltype `INTEGER`)
       - `amount_received_msat` (type `msat`, sqltype `INTEGER`)
    @@ -408,7 +408,7 @@
       - `features` (type `hex`, sqltype `BLOB`)
     
     - `sendpays` indexed by `payment_hash` (see lightning-listsendpays(7))
    -  - `created_index` (type `u64`, sqltype `INTEGER`)
    +  - `created_index` (type `u64`, sqltype `INTEGER PRIMARY KEY`)
       - `id` (type `u64`, sqltype `INTEGER`)
       - `groupid` (type `u64`, sqltype `INTEGER`)
       - `partid` (type `u64`, sqltype `INTEGER`)

Changelog-Changed: Plugins: `sql` tables `forwards`, `htlcs`, `invoices`, `sendpays` all use `created_index` as their primary key (and `rowid` is now an alias to this).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2025-08-19 13:37:50 +09:30
..
askrene askrene: add maxparts 2025-08-15 16:13:19 +09:30
bip353-plugin cln-bip353: add plugin that fetches payment instructions from human readable addresses 2025-08-14 18:41:23 +09:30
bkpr lightningd: make notifications from plugins just like native ones. 2025-08-18 10:01:07 +09:30
examples cln-plugin: trace level logging support 2025-05-05 09:31:22 -07:00
grpc-plugin chore: update docs for uv 2025-08-11 11:06:22 +09:30
lsps-plugin lsps: Add additional documentation 2025-05-02 13:34:21 -07:00
renepay chore: fix some minor issues 2025-08-15 11:05:51 +09:30
rest-plugin clnrest: add more valid request and response types 2025-07-25 08:18:44 -07:00
spender splice: Splice script should not abort on sign 2025-05-13 14:52:15 +09:30
src cln-plugin: adapt send_custom_notification to send modern-style notifications. 2025-08-18 10:01:07 +09:30
test libplugin: correctly wrap notifications we send in the notification name. 2025-08-18 10:01:07 +09:30
wss-proxy-plugin wss-proxy: replaced by a rust version 2025-07-24 12:42:06 -07:00
xpay xpay: add option to pay bip353. 2025-08-18 14:57:46 +09:30
.gitignore lsps: Add service implementation for LSPS0 2025-05-02 13:34:21 -07:00
autoclean.c autoclean: rest between cleanup calls. 2024-11-12 10:42:18 +01:00
bcli.c bcli: don't try asking non-full nodes for blocks. 2025-05-12 10:38:25 +09:30
Cargo.toml crates: bump versions to 0.4.0 2025-03-11 11:10:11 -05:00
chanbackup.c libplugin: make jsonrpc_set_datastore_binary() take an explicit length. 2025-08-14 19:49:09 +09:30
channel_hint.c libplugin: correctly wrap notifications we send in the notification name. 2025-08-18 10:01:07 +09:30
channel_hint.h ccan/htable: update to explicit DUPS/NODUPS types. 2025-01-21 09:18:25 +10:30
commando.c commando: remove old commando rune commands. 2025-06-25 09:06:31 +09:30
establish_onion_path.c offers: fix fetchinvoice from using disconnected peers. 2025-08-18 14:19:27 +09:30
establish_onion_path.h fetchinvoice: use common/onion_message routines. 2024-07-17 10:57:11 +02:00
exposesecret.c plugins/exposesecret: fix for API change. 2024-11-13 13:24:06 +10:30
fetchinvoice.c BOLTS: update which fixes BIP353 quotes, missing invreq field in invoices. 2025-03-18 14:30:58 +10:30
fetchinvoice.h plugins/offers: neaten fetchinvoice integration. 2024-07-17 10:57:11 +02:00
funder.c lightningd: deprecate (undocumented!) "unknown" old_state field in channel_state_changed notification. 2025-05-08 10:49:31 +09:30
funder_policy.c bitcoin: make input witness weight calculation explicit. 2025-05-06 12:27:53 +09:30
funder_policy.h libplugin: allow display of default values. 2024-05-15 15:50:54 -05:00
keysend.c lightningd: remove accept-htlc-tlv-types. 2025-03-12 09:26:08 +10:30
libplugin-pay.c libplugin: correctly wrap notifications we send in the notification name. 2025-08-18 10:01:07 +09:30
libplugin-pay.h libplugin-pay: always use a non-NULL struct command. 2024-11-07 17:04:35 +10:30
libplugin.c libplugin: correctly wrap notifications we send in the notification name. 2025-08-18 10:01:07 +09:30
libplugin.h libplugin: correctly wrap notifications we send in the notification name. 2025-08-18 10:01:07 +09:30
Makefile plugins/sql: add listchainmoves and listchannelmoves. 2025-08-19 13:37:50 +09:30
offers.c offers: don't add blinded path from a disconnected peer. 2025-03-04 20:13:49 -06:00
offers.h offers: don't send blinded path to neighbor for *invoices*. 2025-02-27 13:53:10 -06:00
offers_inv_hook.c BOLT12: remove -offers from bolt12 quotes, update them. 2025-02-11 20:19:01 -06:00
offers_inv_hook.h offers: check they use the blinded path if one is specified. 2024-07-17 10:57:11 +02:00
offers_invreq_hook.c BOLTS: update which fixes BIP353 quotes, missing invreq field in invoices. 2025-03-18 14:30:58 +10:30
offers_invreq_hook.h offers: check they use the blinded path if one is specified. 2024-07-17 10:57:11 +02:00
offers_offer.c offers: don't send blinded path to neighbor for *invoices*. 2025-02-27 13:53:10 -06:00
offers_offer.h plugins: move fetchinvoice functionality into offers plugin. 2024-07-17 10:57:11 +02:00
pay.c BOLT12: remove -offers from bolt12 quotes, update them. 2025-02-11 20:19:01 -06:00
README.md doc: fix wording in plugins/README.md 2020-01-06 12:57:59 +01:00
recklessrpc.c reckless-rpc: increase initial buffer size 2025-08-18 14:04:48 +09:30
recover.c gossmap: add (and use) logging hook. 2025-02-11 15:11:47 -06:00
sql.c plugins/sql: use created_index as primary key, where available. 2025-08-19 13:37:50 +09:30
topology.c plugins/topology: remove local channels from listchannels. 2025-03-12 09:26:08 +10:30
txprepare.c txprepare: fix all amount when other amounts also specified. 2025-05-06 12:27:53 +09:30

Plugin Directory

Any file in this directory which is executable and whose name only consists of alphanumeric characters, space, '.', '-' or '_' will be automatically loaded when lightningd starts (unless suppressed with commandline options).