niftynei
63f8c74da9
psbt: dont crash when printing psbt to log
...
We call `tal_wally_start` and then `tal_wally_start` again in
`type_to_string` for psbt.
end the last tal before calling type to string.
Fixes : #5499
Reported-By: @fiatjaf
lightning_hsmd: FATAL SIGNAL 6 (version v0.11.0.1-231-gddf8fbd-modded)
0x5574ca0d87ef send_backtrace
common/daemon.c:33
0x5574ca0d8877 crashdump
common/daemon.c:46
0x7f76ef63e8df ???
???:0
0x7f76ef68e36c ???
???:0
0x7f76ef63e837 ???
???:0
0x7f76ef628534 ???
???:0
0x5574ca0df55e tal_wally_start
common/utils.c:27
0x5574ca0e4024 psbt_to_b64
bitcoin/psbt.c:687
0x5574ca0e4093 fmt_wally_psbt_
bitcoin/psbt.c:694
0x5574ca0df4b9 type_to_string_
common/type_to_string.c:32
0x5574ca0d5139 sign_our_inputs
hsmd/libhsmd.c:486
0x5574ca0d5206 handle_sign_withdrawal_tx
hsmd/libhsmd.c:1029
0x5574ca0d63c4 hsmd_handle_client_message
hsmd/libhsmd.c:1575
0x5574ca0ce763 handle_client
hsmd/hsmd.c:671
0x5574ca100032 next_plan
ccan/ccan/io/io.c:59
0x5574ca1004b9 do_plan
ccan/ccan/io/io.c:407
0x5574ca100552 io_ready
ccan/ccan/io/io.c:417
0x5574ca101daf io_loop
ccan/ccan/io/poll.c:453
0x5574ca0ceb7b main
hsmd/hsmd.c:739
0x7f76ef62928f ???
???:0
0x7f76ef629349 ???
???:0
0x5574ca0cda04 ???
../sysdeps/x86_64/start.S:115
2022-08-13 12:57:03 -05:00
Ken Sedgwick
0878002fe6
Fix derived_secret, use correct size of secretstuff.derived secret
...
[ Updated tests to match -- RR]
2022-08-10 12:41:27 -05:00
adi2011
64c03f8990
hsmd: Create derive_secret and makesecret RPC for deriving pseudorandom keys from HSM
2022-07-14 12:24:48 -05:00
Michael Dance
f067e8c909
Changed external/libwally-core to test_build_fix
...
Combined with the following commit which is required to
update against changed libsecp256k1 APIs:
Updated deprecated function calls
2022-04-12 15:17:52 +09:30
Rusty Russell
7e789be0ea
doc: update BOLTs to latest master.
...
Just typo fixes and the like.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2022-04-02 09:40:18 +10:30
Ken Sedgwick
8994b8dade
hsmd: Add validate_commitment_tx
2022-03-20 13:06:16 +10:30
Ken Sedgwick
36466af3eb
hsmd: Add fields to hsmd_sign_{,remote_}commitment_tx for validating signers
2022-03-16 12:06:21 +10:30
Ken Sedgwick
335ef3fb69
hsmd: Add hsmd_ready_channel
2021-12-14 11:24:52 +10:30
Ken Sedgwick
bb574be839
hsmd: Add hsmd_new_channel
2021-12-14 11:24:52 +10:30
Ken Sedgwick
fe9f426e07
hsmd: Add hsmd_validate_revocation.
2021-12-14 11:03:13 +10:30
Rusty Russell
4ffda340d3
check: make sure all files outside contrib/ include "config.h" first.
...
And turn "" includes into full-path (which makes it easier to put
config.h first, and finds some cases check-includes.sh missed
previously).
config.h sets _GNU_SOURCE which really needs to be done before any
'#includes': we mainly got away with it with glibc, but other platforms
like Alpine may have stricter requirements.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-12-06 10:05:39 +10:30
Rusty Russell
c503232cde
common: use bitcoin_outpoint.
...
I started pulling this thread, and the entire codebase got unravelled.
Oh well, it's done now!
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-10-15 12:09:36 +02:00
Rusty Russell
8f582e770c
BOLT12: use point32 instead of pubkey32.
...
That's the modern BOLT12 term.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-10-08 13:47:30 +02:00
Rusty Russell
01161aac68
hsmd: derive an onion_reply secret.
...
We put this in reply paths, so we can tell if they are used. This lets us
avoid responding unless the correct reply path is used.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-22 09:10:34 +09:30
Rusty Russell
7401b26824
cleanup: remove unneeded includes in C files.
...
Before:
Ten builds, laptop -j5, no ccache:
```
real 0m36.686000-38.956000(38.608+/-0.65)s
user 2m32.864000-42.253000(40.7545+/-2.7)s
sys 0m16.618000-18.316000(17.8531+/-0.48)s
```
Ten builds, laptop -j5, ccache (warm):
```
real 0m8.212000-8.577000(8.39989+/-0.13)s
user 0m12.731000-13.212000(12.9751+/-0.17)s
sys 0m3.697000-3.902000(3.83722+/-0.064)s
```
After:
Ten builds, laptop -j5, no ccache: 8% faster
```
real 0m33.802000-35.773000(35.468+/-0.54)s
user 2m19.073000-27.754000(26.2542+/-2.3)s
sys 0m15.784000-17.173000(16.7165+/-0.37)s
```
Ten builds, laptop -j5, ccache (warm): 1% faster
```
real 0m8.200000-8.485000(8.30138+/-0.097)s
user 0m12.485000-13.100000(12.7344+/-0.19)s
sys 0m3.702000-3.889000(3.78787+/-0.056)s
```
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-17 09:43:22 +09:30
Rusty Russell
ea30c34d82
cleanup: remove unneeded includes in header files.
...
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-17 09:43:22 +09:30
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
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
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
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