Commit Graph

576 Commits

Author SHA1 Message Date
Rusty Russell c4fe2e7f5a doc: Manual page for sendonionmessage.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-14 13:56:13 +01:00
Rusty Russell 529ae0d766 plugins: allow plugins to disable themselves at startup.
By returning 'disable: <reason>' inside getmanifest or init result.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: plugins: plugins can now disable themselves by returning `disable`, even if marked important.
2021-01-13 14:45:36 +01:00
Rusty Russell 4bb05e46e9 offers: convert currency when they request an invoice.
Means a reshuffle of our logic: we want to multiply by quantity before
conversion for maximum accuracy.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-09 12:45:31 +01:00
Rusty Russell 030a19a8af sendinvoice: don't allow separate invoice and command timeouts.
It was too confusing, and can be added later if desired.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-09 14:34:35 +10:30
Rusty Russell fdc1f75745 doc: fix waitinvoice update.
Waitinvoice also returns once an invoice is expired.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-09 14:34:35 +10:30
Rusty Russell 8f37437a14 doc: update and fix listinvoices output in man page.
1. The field *expiry_time* is actually called *expires_at*.
2. The description field is missing.
3. The bolt11 field is missing.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-09 14:34:35 +10:30
Rusty Russell d867fab3a7 sendinvoice: call waitinvoice directly to on invoice payment.
Suggested-by: Christian Decker
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-09 14:34:35 +10:30
Rusty Russell c08ff167b2 decode: new generic API to decode bolt11 and bolt12.
This is experimental for now, but can eventually deprecated
'decodepay' and even decode other kinds of messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-09 14:34:35 +10:30
Rusty Russell 1aa7e8e011 offers: split offer send_invoice generation into new JSON command
We split `send_invoice` offers inoo offerout (for want of a better name).
This simplifies the API.

Also took the opportunity to move the `vendor` tag to immediately
follow `description` (our tests use arguments by keywords, so no
change there).

Suggested-by: shesek
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-09 14:34:35 +10:30
Rusty Russell 47ce7ff0c1 doc: document experimental commands.
Not the low-level ones, just enough that people can play with the APIs.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-09 14:34:35 +10:30
Christian Decker 91e406ed6f doc: Document existence of `erring_direction` in `sendpay` result
Fixes #3537
2021-01-08 19:28:30 +01:00
Rusty Russell 1a8978100e invoice: add ctlv option.
This is required if we want to create a "bouncer" plugin (in my copious free time!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `invoice` now takes an optional `cltv` parameter.
2021-01-08 10:45:56 +01:00
Christian Decker 0d1b45dfcc json-rpc: Give `waitblockheight` an error code for timeouts
We need to differentiate timeouts from other results, so make it recognizable.
2021-01-08 09:19:24 +01:00
Christian Decker 2981184fac docs: Document `bolt11` and `payment_hash` arguments of listinvoices 2021-01-06 18:48:06 +01:00
Karol Hosiawa a2c208e121 Added spent option to listfunds
Changelog-Added: JSON-RPC: The `listfunds` method now includes spent outputs if the `spent` parameter is set to true.
2020-12-22 13:00:02 +01:00
ZmnSCPxj jxPCSnmZ 423f3944e3 doc/BACKUP.md: Minor typo due to rearranged text.
Changelog-None
2020-12-16 12:36:52 +01:00
ZmnSCPxj jxPCSnmZ 0e326dd3a7 doc/BACKUP.md: Document backup strategies for `lightningd`.
ChangeLog-Added: Document: `doc/BACKUP.md` describes how to back up your C-lightning node.
2020-12-15 12:16:50 +01:00
Rusty Russell 723c16072a cleanups: feedback from Christian Decker review.
1. Hoist 7200 constant into the bolt12 heade2.
2. Make preimage the last createinvoice arg, so we could make it optional.
3. Check the validity of the preimage in createinvoice.
4. Always output used flag in listoffers.
5. Rename wallet offer iterators to offer_id iterators.
6. Fix paramter typos.
7. Rename `local_offer_id` parameter to `localofferid`.
8. Add reference constraints on local_offer_id db fields.
9. Remove cut/paste comment.
10. Clarify source of fatal() messages in wallet.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-12-15 12:05:02 +01:00
Rusty Russell fab0842d31 lightningd: createinvoice low-level invoice creation command.
This takes an unsigned bolt11 (or bolt12 if EXPERIMENTAL_FEATURES) string
and signs it and puts it in the database.

The invoice command could now be moved out to a plugin, in fact.

Changelog-Added: JSON-RPC: `createinvoice` new low-level invoice creation API.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-12-15 12:05:02 +01:00
Rusty Russell d971e3de98 Plugin: support extra args to "start".
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Plugins: `start` command can now take plugin-specific parameters.
2020-12-15 09:28:56 +10:30
Rusty Russell 8a9976c4c1 plugins: support concatenation of multiple args.
"multi" means that specifying a parameter twice will append, not override.
Multi args are always given as a JSON array, even if only one.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Plugins: new "multi" field allows an option to be specified multiple times.
2020-12-15 09:28:56 +10:30
niftynei 1ca2c66c54 make: have `git submodule update` be recursive
libwally added libsecp256k1 as a submodule, so we need to recursively
update the submodules now
2020-12-11 13:20:54 +01:00
Michael Schmoock 4507203a48 doc: fees on listpeers 2020-12-07 14:26:36 +01:00
niftynei e81d78ec4c fundpsbt/utxopsbt: new `min_witness_weight` param
Needed for v2 of channel opens, where the minimum weight is 110; a
'simple utxo' (sig + key) weighs in at 107, so we a need a way to
establish a floor for this case.

Changelog-Added: JSON-RPC: fundpsbt/utxopsbt have new param, `min_witness_utxo`, which sets a floor for the weight calculation of an added input
2020-12-02 14:19:08 +10:30
ZmnSCPxj jxPCSnmZ 32de621886 lightningd/plugin_hook.c: Make `db_write` a chained hook.
Fixes: #4219

Changelog-Changed: Plugins: Multiple plugins can now register `db_write` hooks.
2020-11-30 10:40:11 +10:30
niftynei 6077eca660 df: pass back 'close_to' for completed/commitment secured channels
When commitments are secured, also return the 'close_to' script if we've
got a local_upfront_shutdown_script set.
2020-11-23 12:41:05 -06:00
ZmnSCPxj jxPCSnmZ ff090ecfe6 doc/TOR.md: Add missing instructions to add user to Tor group.
Changelog-None

Fixes: #4208
2020-11-23 12:22:10 -06:00
ZmnSCPxj jxPCSnmZ dc83862fc2 doc/PLUGINS.md: Fix typo. 2020-11-23 12:13:09 -06:00
fiatjaf 9e4bed73d9 optional "failure_onion" in reply to htlc_accepted hook.
Changelog-Added: `htlc_accepted` hook can now return custom `failure_onion`.
2020-11-10 19:03:23 -06:00
Antoine Poinsot 6b347e1895 doc: document output descriptors in hsmtool
Touch a bit about it as a backup/recovery mechanism in the FAQ

Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-11-10 10:34:13 -06:00
positiveblue fa1483a00d `hsm_secret` generation from a seed-phrase
tools: Add `generatehsm` method to hsmtool to derivate BIP32 seeds from a
mnemonic using the BIP39 standard.

The new method uses libwally for the BIP39 to BIP32 derivation. It also
fails if an hsm_secret file already exists, so we do not overwrite
someone else's wallet without noticing.

It allows the use of passphrases, the ECHO mode in the terminal is
disable for higher security.

It currently supports "en", "es", "fr", "it", "jp", "zhs", "zht".

Changelog-Added: hsmtool: `hsm_secret` generation from a seed-phrase following BIP39.
2020-11-09 17:49:24 -06:00
Rusty Russell fb295ffb51 plugin: sort topological candidates by specified order.
We previously registered hooks up in who-replies-to-getmanifest-first
order, but then if any had dependencies it would scatter that order.

This allows users to manually set dependencies developers have
forgotten by specifying the plugins manually in their configuration or
cmdline.  This was an excellent consideration by @mschmook.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-11-09 15:22:33 -06:00
Rusty Russell e2a31f42f2 plugins: allow 'before' and 'after' arrays for hooks.
The next patch will use these to order the hooks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: plugins: hooks can now specify that they must be called 'before' or 'after' other plugins.
2020-11-09 15:22:33 -06:00
Michael Schmoock 86137852d2 doc: update channel_state_changed notification 2020-11-06 14:47:04 -06:00
fiatjaf 15b2546d45 doc: move "next_onion" and "shared_secret" to inside "onion". 2020-11-05 14:15:18 -06:00
Jan Sarenik 90ad541cd2 doc: STYLE.md fix "parameters get"
Changelog-None
2020-10-28 14:32:20 -05:00
Michael Schmoock 6697ebcebb doc: update HACKING.md 2020-10-23 12:47:47 -05:00
Michael Schmoock 5b542195d3 doc: typo in lightning-setchannelfee.7
Changelog-None
2020-10-23 12:47:47 -05:00
Rusty Russell 1e5789d421 close: add notification for slow closes.
For compatibility, we only do this if `allow-deprecated-apis` is false
for now.  Otherwise scripts parsing should use `grep -v '^# '` or
start using `-N none`.

Changelog-Added: JSON-RPC: `close` now sends notifications for slow closes (if `allow-deprecated-apis`=false)
Changelog-Deprecated: cli: scripts should filter out '^# ' or use `-N none`, as commands will start returning notifications soon
Fixes: #3925
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2020-10-23 13:53:16 +10:30
Rusty Russell 41290a436f lightning-cli: print notifications (with '# ' prefix) if received.
This can be suppressed with -N.

Note that we wull get an error with older lightningd, but we ignore it
anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: cli: print notifications and progress bars if commands provide them.
2020-10-23 13:53:16 +10:30
Rusty Russell c732d8707a JSON-RPC: notifications command.
This lets callers enable notifications; we won't send any if they don't.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: JSON-RPC: `notifications` command to enable notifications.
2020-10-23 13:53:16 +10:30
Antoine Poinsot 49dcb90b4e doc: add a document about our fuzz testing integration
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2020-10-21 19:34:39 +02:00
niftynei e66937e012 mfc: Add a `commitment_feerate` optional parameter to multifundchannel
Technically there *are* two feerates that we need to know:
  - the feerate to use for the funding transaction, and
  - the feerate to tell our peer to use for our commitment txs/htlc txs

As written, `multifundchannel` uses the same feerate for both. This
optional parameter will allow us to differentiate between the two, which
will be exceedingly handy for anchor output worlds. ;)

FIXME: test this

Changelog-Added: JSON API: `multifundchannel` has a new optional argument, 'commitment_feerate', which can be used to differentiate between the funding feerate and the channel's initial commitment feerate
2020-10-21 11:24:16 +10:30
niftynei daa55d1221 df: add notification for receiving peer's funding tx sigs
This will allow us to build complex, multi-peer transactions, with
easeTM!

Changelog-Added: EXPERIMENTAL, Plugins: `openchannel_peer_sigs` notification, which contains a peer's signatures for the funding transaction (`opt_dual_fund`)
2020-10-21 09:04:32 +10:30
niftynei 5c04ff1ad7 df: Pass the serial_id of the funding output to openchannel_init caller
This is handy/necessary for getting multifundchannel to work, as we need
to know what output to tell all the other peers about.

Changelog-Added: Experimental!! JSON-RPC: openchannel_init returns a field `funding_serial` that indicates the serial_id of the funding output in the provided PSBT
2020-10-21 06:22:18 +10:30
niftynei b696ec89a5 df-open: use channel_id for openchannel_update and openchannel_signed
Be as specific as possible is a good rule for things, I think
2020-10-20 12:50:31 +10:30
niftynei 8858ae4f3d df-open: commands to update a PSBT or submit a signed PSBT
`openchannel_signed` and `openchannel_update` which allow a user to
continue a openchannel or kick off the completion of a openchannel.

`openchannel_update` should be called until it returns with
`commitments_secured`.
2020-10-20 12:50:31 +10:30
niftynei 06c41a0547 dualfund: opener, openchannel_init command (1/3)
There are 3 commands for opening a channel with dualfunding.
`openchannel_init` is the first of these.

It initializes the open-channel dialog, and stops once we've run out of
updates (input/outputs) to send to the peer.
2020-10-20 12:50:31 +10:30
grubles f1eebb6c59
Add OpenBSD instructions to INSTALL.md (#4136)
Add OpenBSD instructions
2020-10-19 13:03:46 +02:00
niftynei 4926c25bb5 fundchannel: take a 'close_to' address
Finally, extends the 'close_to' functionality up to the flagship 'open a
channel' command.

Changelog-Added: JSON-API `fundchannel` now accepts an optional 'close_to' param, a bitcoin address that the channel funding should be sent to on close. Requires `opt_upfront_shutdownscript`
2020-10-16 13:51:57 +10:30