core-lightning/plugins
Erik De Smedt 4ae18b2cfa cln_rpc: Refactor ConfigOption and Value
Breaking changes here.

This improves the semantics of `ConfigOption` and `options::Value`
drastically.

We've been using `options::Value` for 2 purposes
1. To specify the type and default value of an option
2. Coummunicate how a user configured an option

We fall here in the pit-fall of being poor at both purposes.
I've edited the code to ensure
- `options::Value` -> To read or specify the value of an option
- `option::ValueType` -> To specify the type of an option

**Configure an option**

Let's create an string-typed option create an option named `"required-string-opt"` the
developer has to use the following code.

```rust
let option = ConfigOption::new("required-string", Value::OptString, "description");
```

The semantics of `OptString` might falsely suggest that it is optional to specify the config.
However, we use `OptString` to say we are not providing a default-value.

After this commit we can use instead

```rust
let option = ConfigOption::new_str_no_default("required-string", "description");
```

For reading a configured value the `option::Value` is somewhat
cumbersome. The old version of had 6 different types of value

```rust
let value = plugin.option("required-string");
match value {
  String(s) => {}, 	// User has configured string value or default
  Integer(i) => {},	// User has configured int value or default
  Boolean(b) => {},	// User has configured bool value or default
  OptString => {},      // User has not configured value and no default
  OptInteger = {}, 	// User has not configured value and no default
  OptBOolean => {}, 	// User has not configured value and no default
}
```

This has been changed to

```rust
let value = plugin.option("required-string");
match value {
  Some(String(s)) => {},
  Some(Integer(i)) => {},
  Some(Boolean(b)) => {},
  None => {},
}
```
2024-02-08 15:37:44 +01:00
..
bkpr Remove update_count from find_account_onchain_fees 2024-02-02 17:31:23 +01:00
clnrest clnrest: Import sys in except clause explicitly 2023-11-21 08:24:09 +01:00
examples cln_rpc: Refactor ConfigOption and Value 2024-02-08 15:37:44 +01:00
grpc-plugin cln_rpc: Refactor ConfigOption and Value 2024-02-08 15:37:44 +01:00
renepay fixed source (using raw millisatohis) 2024-02-02 11:28:47 +01:00
spender fundchannel_start & multifundchannel: add channel_type. 2024-01-29 13:40:34 +10:30
src cln_rpc: Refactor ConfigOption and Value 2024-02-08 15:37:44 +01:00
test plugins/pay: use gossmods_from_listpeerchannels instead of private gossip_store records. 2023-12-14 09:16:56 +10:30
.gitignore meta: ignore renepay binary 2023-08-21 10:35:41 +09:30
autoclean.c libplugin: support version strings for deprecations. 2024-01-26 10:30:22 +10:30
bcli.c plugins/bcli: use per-command deprecation flags. 2024-01-26 10:30:22 +10:30
Cargo.toml cln-plugin: Switch from env_logger to tracing-subscriber 2024-01-16 18:36:12 +01:00
chanbackup.c chanbackup: even if they enable experimental-peer-storage, check peers 2023-03-08 18:46:21 -06:00
commando.c commando: use deprecation API for missing ids. 2024-01-26 10:30:22 +10:30
fetchinvoice.c lightningd: remove msatoshi alias for amount_msat. 2024-01-26 10:30:22 +10:30
funder.c funder: don't try to spend emergency_reserve 2024-02-08 06:32:01 +10:30
funder_policy.c libplugin: make set callback for options take plugin ptr, check correct type. 2023-06-20 20:08:25 +09:30
funder_policy.h libplugin: make set callback for options take plugin ptr, check correct type. 2023-06-20 20:08:25 +09:30
keysend.c lightningd: remove msatoshi alias for amount_msat. 2024-01-26 10:30:22 +10:30
libplugin-pay.c plugins/pay: use gossmods_from_listpeerchannels instead of private gossip_store records. 2023-12-14 09:16:56 +10:30
libplugin-pay.h plugins/pay: use gossmods_from_listpeerchannels instead of private gossip_store records. 2023-12-14 09:16:56 +10:30
libplugin.c libplugin: remove global deprecated_apis flag. 2024-01-26 10:30:22 +10:30
libplugin.h libplugin: remove global deprecated_apis flag. 2024-01-26 10:30:22 +10:30
Makefile spenderp: add channel_type parameter to fundchannel / multifundchannel. 2024-01-29 13:40:34 +10:30
offers.c plugins/offers: Extend the capability of decode to decrypt the contents of emergency.recover file. 2023-10-27 16:05:28 +10:30
offers.h common: update to latest onion message spec. 2022-10-26 11:29:06 +10:30
offers_inv_hook.c lightningd: re-add 'offerout' functionality, as 'invoicerequest'. 2022-11-09 15:08:03 +01:00
offers_inv_hook.h lightningd: re-add 'offerout' functionality, as 'invoicerequest'. 2022-11-09 15:08:03 +01:00
offers_invreq_hook.c offers: fix pay where we are using deprecated apis. 2023-02-03 16:59:51 +01:00
offers_invreq_hook.h offers: create a real blinded path, if necessary. 2022-11-09 15:08:03 +01:00
offers_offer.c lightningd: deprecate @-prefix hack for offer recurrence_base. 2024-02-07 09:21:00 +10:30
offers_offer.h lightningd: re-add 'offerout' functionality, as 'invoicerequest'. 2022-11-09 15:08:03 +01:00
pay.c lightningd: remove msatoshi alias for amount_msat. 2024-01-26 10:30:22 +10:30
README.md doc: fix wording in plugins/README.md 2020-01-06 12:57:59 +01:00
sql.c gossipd: strip private updates from gossip_store on startup. 2024-01-31 14:47:33 +10:30
topology.c gossipd: new routines to support gossmap compatibility. 2024-02-04 09:24:44 +10:30
txprepare.c plugins: remove #if DEVELOPER. 2023-09-21 20:08:24 +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).