Commit Graph

6807 Commits

Author SHA1 Message Date
lisa neigut
c6338573d6 nits: align codes 2019-10-10 05:57:45 +00:00
lisa neigut
496d2cae5f varint: Add helper function for getting varlen size
Needed to calculate somethings for building dual funding txs
2019-10-10 05:57:45 +00:00
lisa neigut
cb2cad8c94 script: add helper for checking if a 'known type'
To be used for verifying remote inputs' validity
2019-10-10 05:57:45 +00:00
lisa neigut
6f85088b2b tools: add handy debug error 2019-10-10 05:57:45 +00:00
lisa neigut
3f1f075421 tools: add ability to wrap wire messages with ifs
Makes it possible to hide wire messages behind EXPERIMENTAL_FEATURES
flag.
2019-10-10 05:57:45 +00:00
lisa neigut
9e29a47cf8 contrib: add aliases for logs
Add aliases 'l1-log' and 'l2-log' to startup_regtest script
2019-10-10 05:57:45 +00:00
darosior
fac5faacc0 Document hsm_secret encryption 2019-10-09 22:00:38 -05:00
darosior
1c27545f9e pytest: test hsm_secret encryption 2019-10-09 22:00:38 -05:00
darosior
c9982f9f49 pytest: allow to set stdin, stdout and stderr at lightningd startup
And also allow to not wait for it to be started.
Passing stderr=subprocess.STDOUT can be useful to wait_for_log() also on
stderr messages.
2019-10-09 22:00:38 -05:00
darosior
6f9030168e lightningd: prevent hsmd from interpretating an encrypted hsm_secret as not encrypted 2019-10-09 22:00:38 -05:00
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