Commit Graph

220 Commits

Author SHA1 Message Date
Rusty Russell
cb22015b2a common/channel_type: wrapper for generated 'struct channel_type'.
We make it a first-class citizen internally, even though we won't use
it over the wire (at least, non-experimental builds).  This scheme
follows the latest draft, in which features are flagged compulsory.

We also add several helper functions.

Since uses the *even* bits (as per latest spec), not the *odd* bits,
we have some other fixups.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-13 15:53:23 +02:00
Rusty Russell
1b8551923d tools: handle generating print templates for CSV without tlvs, messages
We want to use this to handle the simple description for channel_type.

It also needs to handle variable-size types (just like subtypes).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-13 15:53:23 +02:00
Rusty Russell
fb4edc2938 Makefile: update bolt version to include option_anchors_zero_fee_htlc_tx.
This touches a lot of text, mainly to change "if `option_anchor_outputs`"
to "if `option_anchors`"

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-09 12:04:48 +09:30
Rusty Russell
a5fee67b91 common/memleak: take over dump_memleak(), allow print pointer.
This will let plugins use it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-08 19:11:47 +02:00
Rusty Russell
ceb40dea38 lightningd: don't turn zero-length tlv fields into NULL.
Fixes: #4667
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-07-21 13:27:27 -04:00
niftynei
265f960cfe liquidity-ads: persist channel blockheight states to disk
Adds new tables to database, backfills, basically copies the fee_rates
state machine for channeld.
2021-07-20 13:28:38 -04:00
niftynei
5989433810 lease_rates: pass in 'lease_expiry' and 'csv' to commitments/channel 2021-07-20 13:28:38 -04:00
niftynei
c9d2748081 lease_rates: add csv lock to modify anchor scripts 2021-07-20 13:28:38 -04:00
niftynei
e992b54410 script: add csv_lock to scripts 2021-07-20 13:28:38 -04:00
niftynei
9dd0a2c2e5 channel-lease: validate accepter's sig on lease terms 2021-07-20 13:28:38 -04:00
niftynei
3a7b3762a1 hsmd: method to sign liquidity ad offer
When we accept a bid to create a channel lease, we send back a signature
committing to our max channel lease amounts.
2021-07-20 13:28:38 -04:00
Christian Decker
b4ead97517 tlv: Allow passing some extra types to accept when parsing the stream 2021-06-26 10:55:13 +09:30
Rusty Russell
2fea448498 gen/impl_template: fix generation of singleton varsize elements.
And as Lisa requested, add testcases.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-06-04 16:13:08 +09:30
Christian Decker
323b1a558b libhsmd: Add missing implementation of status functions 2021-05-15 09:31:12 +09:30
Christian Decker
96acafcef3 libhsmd: Prefix check_client_capabilities
I wante to hide it inside the library, but it is good to have a single
place to verify that the client was permitted to send a message we are
handling, so make it officially part of the interface by prefixing it.
2021-05-04 11:18:52 +09:30
Christian Decker
fb2b107bef libhsmd: Cleanup the bip32_key_version 2021-05-04 11:18:52 +09:30
Christian Decker
4d43e84afd libhsmd: Finalize encapsulation of hsmd data in libhsmd
Changelog-Added: libhsmd: Extracted the `hsmd` logic into its own library for other projects to use
2021-05-04 11:18:52 +09:30
Christian Decker
c9e9581b35 libhsmd: Migrate bolt12 initialization into hsmd_init 2021-05-04 11:18:52 +09:30
Christian Decker
d30392c432 libhsmd: Start migrating initialization to hsmd_init 2021-05-04 11:18:52 +09:30
Christian Decker
befa7fb9f0 libhsmd: Clean up includes in hsmd.c 2021-05-04 11:18:52 +09:30
Christian Decker
1efa792edc libhsmd: Migrate handle_sign_delayer_payment_to_us 2021-05-04 11:18:52 +09:30
Christian Decker
fe82181fe3 libhsmd: Migrate handle_sign_remote_htlc_to_us 2021-05-04 11:18:52 +09:30
Christian Decker
e643594104 libhsmd: handle_sign_commitment_tx 2021-05-04 11:18:52 +09:30
Christian Decker
4764ebd879 libhsmd: Migrate handle_sign_penalty_to_us 2021-05-04 11:18:52 +09:30
Christian Decker
bee7a65170 libhsmd: Migrate handle_sign_remote_commitment_tx 2021-05-04 11:18:52 +09:30
Christian Decker
c2d035d377 libhsmd: Migrate handle_sign_remote_htlc_tx 2021-05-04 11:18:52 +09:30
Christian Decker
7b2c6ec4d3 libhsmd: Migrate handle_sign_local_htlc_tx 2021-05-04 11:18:52 +09:30
Christian Decker
cd8fb641cf libhsmd: Migrate handle_sign_mutual_tx 2021-05-04 11:18:52 +09:30
Christian Decker
9aa4b5198d libhsmd: Migrate handle_sign_withdrawal_tx 2021-05-04 11:18:52 +09:30
Christian Decker
e7007a7f36 libhsmd: Migrate handle_get_per_commitment_point 2021-05-04 11:18:52 +09:30
Christian Decker
eab4aeaed3 libhsmd: Migrate handle_channel_update_sig 2021-05-04 11:18:52 +09:30
Christian Decker
166f0ade04 libhsmd: Migrate handle_sign_node_announcement 2021-05-04 11:18:52 +09:30
Christian Decker
4a3f24a737 libhsmd: Migrate handle_cannouncement_sig 2021-05-04 11:18:52 +09:30
Christian Decker
e9cc8644b6 libhsmd: Migrate handle_get_output_scriptpubkey 2021-05-04 11:18:52 +09:30
Christian Decker
ec5d40c0e7 libhsmd: Migrate handle_check_future_secret 2021-05-04 11:18:52 +09:30
Christian Decker
0e61ed32e3 libhsmd: Migrate handle_ecdh 2021-05-04 11:18:52 +09:30
Christian Decker
d1b3a5b1aa libhsmd: Migrate handle_get_channel_basepoints 2021-05-04 11:18:52 +09:30
Christian Decker
2cb25a16e0 libhsmd: Migrate handle_sign_invoice 2021-05-04 11:18:52 +09:30
Christian Decker
79ec4b4808 libhsmd: Migrate handle_sign_bolt12 2021-05-04 11:18:52 +09:30
Christian Decker
3d959e128d libhsmd: Add dispatcher function 2021-05-04 11:18:52 +09:30
Christian Decker
ac836bbd1b libhsmd: Add status functions to report to whoever is listening
These are currently just shims that replicate the old behavior, but
when compiling as a library we can relink the status_* functions to
something that makes sense in the context of the user, and not assume
we're running as a subdaemon.
2021-05-04 11:18:52 +09:30
Christian Decker
b5a2ddd384 libhsmd: Migrate check_client_capabilities to libhsmd 2021-05-04 11:18:52 +09:30
Christian Decker
ed4676bea8 libhsmd: Add scaffolding to start separating hsmd from io logic 2021-05-04 11:18:52 +09:30
Rusty Russell
9dbac21d3b doc: remove suffix for included-in-master BOLTs.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-04-07 14:34:39 +09:30
Christian Decker
65bf347ad3 hsmd: Ensure the hsmd is initialized before anything else is called
Just a security measure to avoid alternative use-cases of the hsmd
running into the issue that they need to send a `WIRE_HSMD_INIT`
message as first message. If that is not done, the `secretstuff` won't
get initialized and we'd be producing signatures from uninitialized
memory, which are completely useless.

Changelog-None: Internal change only
2021-03-09 14:40:02 +10:30
Rusty Russell
001b5d6416 offers: make it a runtime option.
The fetchinvoice and offers plugins disable themselves if the option
isn't enabled (it's enabled by default on EXPERIMENTAL_FEATURES).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: `experimental-offers` enables fetch, payment and creation of (early draft) offers.
2021-01-13 14:45:36 +01:00
Rusty Russell
6dab04ebd5 tools/generate-wire.py: include digits in #ifndef idempotent header.
Otherwise check complains that it's '#ifndef LIGHTNING_WIRE_BOLT_WIREGEN_H':

wire/bolt12_wiregen.h seems to be missing the expected include guard:
  #ifndef LIGHTNING_WIRE_BOLT12_WIREGEN_H
  #define LIGHTNING_WIRE_BOLT12_WIREGEN_H
  ...
  #endif /* LIGHTNING_WIRE_BOLT12_WIREGEN_H */

make: *** [Makefile:458: check-includes] Error 1

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-01-13 14:45:36 +01:00
Antoine Poinsot
45bb1bfa3c hsmd: cleanup encrypted hsm_secret detection
This makes use of the constant defined in the previous commits to more
accurately detect plaintext, encrypted, and invalid seeds. We now error
on invalid seeds.

Changelog-changed: hsmd: we now error at startup on invalid hsm_secret
Changelog-changed: hsmtool: all commands now error on invalid hsm_secret
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-01-06 13:50:01 +01:00
Antoine Poinsot
d2a903992c hsmd: regroup hsm_secret decryption logic
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-01-06 13:50:01 +01:00
Antoine Poinsot
c6bc22b0f5 hsmd: group hsm_secret encryption
Signed-off-by: Antoine Poinsot <darosior@protonmail.com>
2021-01-06 13:50:01 +01:00