Commit Graph

6739 Commits

Author SHA1 Message Date
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
Luca Ambrosini
11124fa3bf Add compability to current formalism to short_channel_id-to-txid.sh
* Add compatibility with the new shortchannelid syntax with x as separator

* Add an error message in case the parse failed, instead of receveing an unrelated error from the bitcoin-cli
2019-10-04 00:38:52 +00:00
Rusty Russell
fa686c5ca7 channeld: reject wumbo payments with more style.
WIRE_REQUIRED_CHANNEL_FEATURE_MISSING anticipates a glorious Wumbo future,
and is closer to correct (it's a PERM failure).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-03 23:27:23 +00:00
Rusty Russell
776674117b libwally: upgrade to v0.7.4.
On master I get a crash and the following from valgrind, which
seems like a libwally bug.  Upgrading made it go away.

==45076== Invalid read of size 1
==45076==    at 0x1191A1: topo_add_utxos (chaintopology.c:657)
==45076==    by 0x11935F: add_tip (chaintopology.c:681)
==45076==    by 0x1197E6: have_new_block (chaintopology.c:761)
==45076==    by 0x114BB0: process_rawblock (bitcoind.c:480)
==45076==    by 0x1140A0: bcli_finished (bitcoind.c:227)
==45076==    by 0x1A4CA2: destroy_conn (poll.c:244)
==45076==    by 0x1A4CC2: destroy_conn_close_fd (poll.c:250)
==45076==    by 0x1B28CD: notify (tal.c:235)
==45076==    by 0x1B2DBC: del_tree (tal.c:397)
==45076==    by 0x1B3148: tal_free (tal.c:481)
==45076==    by 0x1A34C1: io_close (io.c:450)
==45076==    by 0x1A53DD: io_loop (poll.c:449)
==45076==  Address 0x59fc658 is 4 bytes after a block of size 4 alloc'd
==45076==    at 0x483874F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==45076==    by 0x1BD3A5: tx_from_bytes (in /home/rusty/lightning-ltest/lightningd/lightningd)
==45076==    by 0x1715C3: pull_bitcoin_tx (tx.c:411)
==45076==    by 0x16B25A: bitcoin_block_from_hex (block.c:54)
==45076==    by 0x114B45: process_rawblock (bitcoind.c:473)
==45076==    by 0x1140A0: bcli_finished (bitcoind.c:227)
==45076==    by 0x1A4CA2: destroy_conn (poll.c:244)
==45076==    by 0x1A4CC2: destroy_conn_close_fd (poll.c:250)
==45076==    by 0x1B28CD: notify (tal.c:235)
==45076==    by 0x1B2DBC: del_tree (tal.c:397)
==45076==    by 0x1B3148: tal_free (tal.c:481)
==45076==    by 0x1A34C1: io_close (io.c:450)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2019-10-03 18:08:28 +02:00
Saibato
b3a6279392 Allow --announce-addr to work also with autotor: prefix
Make --announce-addr with autotor: also
a meaningful use case.
The option  --announce-addr=autotor: is more
intuitive than to use the --addr=autotor: option

Signed-off-by: Saibato <saibato.naga@pm.me>

Declare opt_add_addr at top of option.c

We we use opt_add_addr and opt_announce_addr vice versa.
To make compiler happy, we declare it at top.

Signed-off-by: Saibato <saibato.naga@pm.me>
2019-10-03 06:08:09 +00:00
Christian Decker
7283efa5b5 elements: Add amount_asset to support more than just plain satoshis
Currently the only source for amount_asset is the value getter on a tx output,
and we don't hand it too far around (mainly ignoring it if it isn't the
chain's main currency). Eventually we could bubble them up to the wallet, use
them to select outputs or actually support assets in the channels.

Since we don't hand them around too widely I thought it was ok for them to be
pass-by-value rather than having to allocate them and pass them around by
reference. They're just 41 bytes currently so the overhead should be ok.

Signed-off-by: Christian Decker <@cdecker>
2019-10-03 04:32:57 +00:00
Christian Decker
c38afc5512 tx: Switch to amount_sat for fee computations
Suggested-by: Rusty Russell <@rustyrussell>
2019-10-03 04:32:57 +00:00
Christian Decker
d5f0c08a88 elements: Remove global is_elements variable in favor of chainparams
No need to keep duplicate globals.
2019-10-03 04:32:57 +00:00
Christian Decker
ef7a63d8f8 elements: Move from a global is_elements to a global chainparams
We now have a pointer to chainparams, that fails valgrind if we do anything
chain-specific before setting it.

Suggested-by: Rusty Russell <@rustyrussell>
2019-10-03 04:32:57 +00:00