Commit Graph

6747 Commits

Author SHA1 Message Date
darosior d393cda215 hsmd: encrypt hsm_secret if 'lightningd' pass an encryption key
This splits maybe_create_hsm_secret() in two parts (either encrypted
or in clear) for clarity, and adds an encryption detection in load_hsm().
There are actually three cases if an encryption key is passed:
- There is no hsm_secret => just create it and store the encrypted seed
- There is an encrypted hsm_secret => the provided key should be able to
decrypt the seed, if the wrong key is passed libsodium will nicely error
and hsmd will exit() to not throw a backtrace (using status_failed() as for
other errors) at the face of an user who mistyped its password.
- There is a non-encrypted hsm_secret => load the seed, delete the
hsm_secret, create the hsm_secret, store the encrypted seed.
2019-10-09 22:00:38 -05:00
darosior 62896566d0 lightningd: pass the hsm_secret encryption key in hsm_init 2019-10-09 22:00:38 -05:00
darosior a698395bf0 lightningd: '--encrypted-hsm', a new startup option
Add a new startup option which will, if set, prompt the user for a
password to derive a key from. This key will later be used to encrypt
and/or decrypt `hsm_secret`.

This was made a noarg option even if it would have been preferable to
let the user the choice of how to specify the password. Since we have
to chose, better to not let the password in the commands history.
2019-10-09 22:00:38 -05:00
darosior fe2543d8dc daemons: initialize libsodium at setup
According to the doc (https://download.libsodium.org/doc):
"sodium_init() initializes the library and should be called before
any other function provided by Sodium. [...]
the function ensures that the system's random number generator has
been properly seeded.".
2019-10-09 22:00:38 -05:00
lisa neigut 2c69ece7fe close: update short help text
Update short help text to match undeprecated close API
2019-10-09 21:04:16 -05:00
trueptolemy 9d4cccda19 pytest: Add the test for compact of deprecated close style 2019-10-09 21:04:16 -05:00
trueptolemy bb5aa774e2 CHANGELOG: Add the entry about `destination` in `close` 2019-10-09 21:04:16 -05:00
trueptolemy e53d065230 doc: Update the doc about `destination` of `close` 2019-10-09 21:04:16 -05:00
trueptolemy 63af8632b7 pytest: Test `close` to the specified destination 2019-10-09 21:04:16 -05:00
trueptolemy 019c052123 JSON-API: Allow `close` channel to specified address
Command format: close id [unilateraltimeout] [destination]

Close the channel with peer {id}, forcing a unilateral
close after {unilateraltimeout} seconds if non-zero, and
the to-local output will be sent to {destination}. If
{destination} isn't specified, the default is the address
of lightningd.

Also change the pylightning:
update the `close` API to support `destination` parameter
2019-10-09 21:04:16 -05:00
trueptolemy 71b606e050 lightningd: Add a new field `shutdown_scriptpubkey[NUM_SIDES]`
`shutdown_scriptpubkey[REMOTE]` is original remote_shutdown_scriptpubkey;
`shutdown_scriptpubkey[LOCAL]` is the script used for "to-local" output when `close`. Add the default is generated form `final_key_idx`;

Store `shutdown_scriptpubkey[LOCAL]` into wallet;
2019-10-09 21:04:16 -05:00
trueptolemy a1204a0b94 Closed: Cleanup for `wire_closing_init`
`final_scriptpubkey` is repeated with `funding_pubkey[LOCAL]`.
2019-10-09 21:04:16 -05:00
trueptolemy 75e946d256 json: Move `param_bitcoin_address` from wallet/walletrpc.c to lightningd/json.c
It's a useful helper, and it will be used to prase address in `close` command.
2019-10-09 21:04:16 -05:00
trueptolemy 8346d5c353 josn: Move `json_tok_address_scriptpubkey` from lightningd/jsonrpc.c to lightningd/json.c
Its declaration is in lightningd/json.h, so we should move it to lightningd/json.c.
2019-10-09 21:04:16 -05:00
darosior 7fd2f6db6d gossipd: query_messages: fail the connection if peer says it does not have up-to-date infos
It is most likely not on the same network, and in any case not a good peer to gossip with.
2019-10-09 16:54:39 -05:00
darosior 2638947ddc gossipd: query_scid: respond with complete to 0 on wrong chain_hash 2019-10-09 16:54:39 -05:00
darosior d3c8225968 gossipd: add a BOLT#7 comment when wrong chain_hash in 'query_channel_range'
And correct some typos
2019-10-09 16:54:39 -05:00
trueptolemy d59015d4ca CHANGELOG: Add the entries about the new parameter name `amount` 2019-10-09 16:51:42 -05:00
trueptolemy e4cd5df06c doc: Use `amount` as the parameter name for `fundchannel` 2019-10-09 16:51:42 -05:00
trueptolemy fdb90a765e pytest: Test compact of the old-style `fundchannel_start` 2019-10-09 16:51:42 -05:00
trueptolemy d149ba2f3a JSON-API: `fundchannel_start` uses `amount` fieldname to replace `satoshi` 2019-10-09 16:51:42 -05:00
trueptolemy 25583ffe37 doc: Use `amount` as the parameter name for `fundchannel` 2019-10-09 16:51:42 -05:00
trueptolemy 987e4e27e8 pytest: Test compact of the old-style `fundchannel` 2019-10-09 16:51:42 -05:00
trueptolemy aafa16786d JSON-API: `fundchannel` uses `amount` fieldname to replace `satoshi` 2019-10-09 16:51:42 -05:00
trueptolemy 7db3f1b8a6 json: Rename `json_tok_address_scriptpubkey` to `json_to_address_scriptpubkey`
Our json naming style is like `json_to_***`.
2019-10-09 16:51:42 -05:00
trueptolemy c6a4bac8b6 Fix: Fix the doc of `txprepare`. Add the description of some parameters. 2019-10-09 16:51:42 -05:00
trueptolemy 722974a36f pytest: Test compact of the old-style `txprepare` 2019-10-09 16:51:42 -05:00
trueptolemy 24575c9fa4 pylightning: Fix the compat of `txprepare` 2019-10-09 16:51:42 -05:00
trueptolemy 36bc624928 Fix: fix the parameter prase of `txprepare`
The old prase process doesn't work!!
2019-10-09 16:51:42 -05:00
darosior 43e55fc8e4 pytest: test lightningd startup with a relative config dir 2019-10-08 22:43:30 +00:00
darosior 65479ab308 config: make config_dir absolute
This makes it easier for DB drivers and plugins
2019-10-08 22:43:30 +00:00
Rusty Russell f019dc3d71 lightningd: fix sizeof() argument correctly.
c25ce826ab claimed to fix this, but didn't;
this is the correct fix.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-08 09:51:22 -05:00
Rusty Russell 93865bb0f3 wallet: minor style fixes, and remove null JSON fields.
Our policy is generally to omit fields which aren't sensible.
Also, @niftynei points out the spacing in for loops.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-07 20:03:24 -05:00
Christian Decker bf859bd919 pytest: Test transaction annotations for deposit and channel open 2019-10-07 20:03:24 -05:00
Christian Decker 55af02b163 wallet: Fix a column access size mismatch when reading tx types 2019-10-07 20:03:24 -05:00
Christian Decker d840496e53 json-rpc: Make listtransaction non-experimental but hide annotations
We haven't tested the annotation for completeness yet, so let's not have
people start relying on them just yet.
2019-10-07 20:03:24 -05:00
Christian Decker ff4a2bf38f onchaind: Annotate inputs and outputs not the transactions 2019-10-07 20:03:24 -05:00
Christian Decker af53e3494b wallet: Annotate only the funding output instead of the whole tx 2019-10-07 20:03:24 -05:00
Christian Decker 33bb4f7f58 json-rpc: Print details and annotations for listtransactions 2019-10-07 20:03:24 -05:00
Christian Decker d981b58234 wallet: Retrieve transaction annotations when listing transactions
This triple join should be efficient to read, and to process. We have a
one-to-many (tx-to-annotations), followed by a
one-to-one (annotation-to-channel) join, so we are limited to annotations x
transactions results.
2019-10-07 20:03:24 -05:00
Christian Decker ddae604f3d wallet: Move tx annotation for deposits into the wallet
We have split the iteration over the txs and the output in different
functions, so pushing the annotation down, while keeping the transaction
addition atop. This showcases the need to not have the txid reference the
transactions.id in the DB: we annotate in a function that doesn't have the tx
index context, but only add the TX after we have finished extracting.
2019-10-07 20:03:24 -05:00
Christian Decker 3d14c18074 wallet: Add primitives to annotate a transaction input and output
We'll slowly migrate from the tx annotations to the input and output we are
interested in.
2019-10-07 20:03:24 -05:00
Christian Decker 2bfe9ffdf8 wallet: Add transaction annotation type
This will indicate whether we are annotating the transaction itself (legacy),
an input or an output.
2019-10-07 20:03:24 -05:00
Christian Decker 964156dc2d db: Add transaction_annotations table 2019-10-07 20:03:24 -05:00
darosior 3ca7150c03 lightningd: initialize global chainparams in main.
Otherwise the global is only set when passing the '--network' startup
option, hence causing a segfault when not passed.
2019-10-08 00:18:48 +00:00
Yash Bhutwala c25ce826ab take the size of 'shared_secret' itself rather than its address 2019-10-07 11:32:33 -05:00
Rusty Russell 33c658ecfb gossipd: advertize all our features in node_announcement.
This preempts the acceptance of
https://github.com/lightningnetwork/lightning-rfc/pull/666 but it's
clear that feature bits are going to be distinct, so this is safe to
do anyway.

See https://github.com/lightningnetwork/lightning-rfc/pull/680

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-07 05:51:05 +00:00
Yash Bhutwala 30ec739c15 check for return code in the else block 2019-10-06 22:36:05 -05:00
Christian Decker 68222ddc7b travis: Force flaky on travis, they are becoming really annoying
Flaky tests send wrong signals, and we restart anyway. We should rather track
flakiness an open issues when they become too regular.
2019-10-05 03:32:55 +00:00
darosior 0d73777695 doc: update mrkd requirement 2019-10-05 03:25:12 +00:00