Commit Graph

4779 Commits

Author SHA1 Message Date
Rusty Russell fe11ee5406 pytest: make test_multirpc check that RPC commands complete.
This was hanging sometimes in travis, but actually checking the result
of the commands makes it *always* hang.  We remove the waitinvoice
which will not return.

ZmnSCPxj points out that this behavior, introduced in
ce0bd7abd3, is a regression: it would be
nice to be able to cancel a waitinvoice.  But that fix is more complex,
and will have to be another PR.

This test will now hang, but it's OK: we're about to fix it!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-19 21:36:40 +01:00
Conor Scott 9a0f3a764c [pylightning] Fix lightning-pay script 2018-11-19 21:24:03 +01:00
arowser d5aaa11373 update match network log 2018-11-15 20:19:34 +01:00
Conor Scott 189fca4039 [doc] Remove old GOSSIPING state from docs 2018-11-15 11:29:04 +01:00
Conor Scott a92c7911a7 [docs]: Link developer guide to main README.md 2018-11-14 03:24:03 +00:00
Christian Decker 6c649ce775 docs: Mention that msatoshi on pay is not optional, but ignored
Reported-by: Tim Horie <@thorie7912>
Signed-off-by: Christian Decker <@cdecker>
2018-11-13 06:17:50 +01:00
Christian Decker b02861bfe1 plugin: Give each plugin their own log-prefix
There is no good naming just yet, so we just number them 1 to n.
2018-11-13 00:44:50 +01:00
Christian Decker 74c58e9f25 docs: Add an initial draft of the plugin documentation
Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Christian Decker 805a76a97f plugin: Make the plugins a list
Suggested-by: Rusty Russell <@rustyrussell>
Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Christian Decker 775e4b784d plugin: Get rid of redundant stdin and stdout members
Suggested-by: Rusty Russell <@rustyrussell>
Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Christian Decker e6ef675ea1 plugin: Send the configure request once we collected all options
This is the final step to get the plugins working. After parsing the
early options (including `--plugin`), then starting and asking the
plugins for options, and finally reading in the options we just
registered, we just need to assemble the options and send them over.

Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Christian Decker 2b3059be0c plugin: Have the helloworld plugin accept a configure message
Just customizes the greeting, the actual sending is in the next commit.

Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Christian Decker 3abc32cbbc plugin: Terminate objects with an empty line to signal end
This is just meant as a hint to the plugin that the message is done,
and it can try to parse the buffer.

Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Christian Decker 404352fc7e plugin: Configure plugins once we've collected all cli options 2018-11-13 00:44:50 +01:00
Christian Decker 55d6d6b0e7 plugin: Register plugin cli options
We also make `--help` a non-early arg so it allows for the plugins to
register their options before printing the help message. The options
themselves are stored in a separate struct inbetween them being
registered and them being forwarded to the plugin. Currently only
supports string options.

Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Christian Decker 10338983a6 plugin: Add logs to plugin and add method to kill a plugin
Also includes some sanity checks for the results returned by the
plugin, such as ensuring that the ID is as expected and that we have
either an error or a real result.
2018-11-13 00:44:50 +01:00
Christian Decker 8e83d43c39 opts: Split early from non-early args so plugins can register theirs
The idea is that `plugin` is an early arg that is parsed (from command
line or the config file). We can then start the plugins and have them
tell us about the options they'd like to add to the mix, before we
actually parse them.

Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Christian Decker 084224f134 plugin: Add request muxing to the plugin subsystem 2018-11-13 00:44:50 +01:00
Christian Decker d0de6e59c6 plugin: Start each plugin and setup the connection to it
Mostly copied from bitcoind.c
2018-11-13 00:44:50 +01:00
Christian Decker c71f4f3bd9 plugin: Add listconfigs stub for the --plugin option 2018-11-13 00:44:50 +01:00
Christian Decker 59e37c12cd plugin: Add plugins to lightningd and register arguments 2018-11-13 00:44:50 +01:00
Christian Decker b6a1735929 plugin: Basic scaffolding for the plugin subsystem 2018-11-13 00:44:50 +01:00
Christian Decker f7116c3a43 plugins: Add simple helloworld plugin to test against
It does double duty to show how a simple plugin might work.
2018-11-13 00:44:50 +01:00
Christian Decker 045f7ce7f7 ccan: Update ccan modules to include incomplete option parsing
Signed-off-by: Christian Decker <@cdecker>
2018-11-13 00:44:50 +01:00
Rusty Russell 62e6a9ff54 travis: add test for compilation with higher optimization.
This can give more warnings, so we should test it.  Bad for debugging,
though.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-07 04:49:41 +01:00
Rusty Russell c5ee905c92 gossipwith: correctly replace all ccan/io operations in handshake.c.
This is kind of a hack, but let's make it a complete hack.  GCC with
-flto noticed we use different definitions of 'struct io_conn' here
and gave the warning:

ccan/ccan/io/io.h:620:17: warning: type of ‘io_close’ does not match original declaration [-Wlto-type-mismatch]
 struct io_plan *io_close(struct io_conn *conn);
                 ^
ccan/ccan/io/io.c:449:17: note: ‘io_close’ was previously declared here
 struct io_plan *io_close(struct io_conn *conn)
                 ^
ccan/ccan/io/io.c:449:17: note: code may be misoptimized unless -fno-strict-aliasing is used

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-07 04:49:41 +01:00
Rusty Russell c13a355cf2 subdaemon: suppress overzealous _FORTIFY_SOURCE warning.
Ubuntu defines _FORTIFY_SOURCE when compiling with optimization.  This
insanity is the result.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-07 04:49:41 +01:00
William Casarin ad1cf8b40c build: fix compilation error on gcc 7.3.0
Signed-off-by: William Casarin <jb55@jb55.com>
2018-11-04 04:22:40 +00:00
Christian Decker d5bb536ef0 docker: Parameterize the bitcoind and litecoind versions 2018-11-03 07:25:01 +00:00
Christian Decker 50a45fdb12 travis: Filter out Travis-related envvars
This is causing us to attempt to have a home directory in /home/travis
instead of the user's real homedir.
2018-11-03 07:25:01 +00:00
Christian Decker c2a9a79c0a docker: Update litecoin to non-vulnerable version
This was forgotten in #2021

Signed-off-by: Christian Decker <@cdecker>
Reported-by: Romano <@romanornr>
2018-11-03 07:25:01 +00:00
Rusty Russell 0c545d00a2 CHANGELOG: note that we fixed uppercase invoices.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-02 05:58:01 +00:00
Rusty Russell bc230c837e bolt11: make sure we handle uppercase invoices.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-02 05:58:01 +00:00
Rusty Russell 33c21d8a98 Revert "bolt11: better message when you try to 'lightning-cli pay' an onchain addr."
This reverts commit 6af8f29392.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-02 05:58:01 +00:00
Rusty Russell 3d1005f83c common/bolt11: test for invoices without hrp separator.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-02 05:58:01 +00:00
Rusty Russell a1898b699d bech32: fix overflow bug.
Copied from upstream:

 2b0aac650c

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-02 05:58:01 +00:00
Rusty Russell 1935614979 closingd: retransmit `shutdown` on reconnect.
The spec says so, and it's right: with the right pattern of packet loss
(thanks Travis!) the other end can still be in channeld, waiting for our
`shutdown` message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-11-01 23:31:54 +01:00
Rusty Russell d4f164eb39 Release: add helper script for release, and checklist for the process.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-31 10:56:44 +10:30
Rusty Russell 22b8a88b48 common/daemon: in DEVELOPER mode, check for tal_parent() loops.
If you steal something onto its own child, you create a loop.  These are
expensive to check for at runtime, but they can hide from memleak and are
usually a bad idea.  So we add a tal_steal() notify which does this work
in DEVELOPER mdoe.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-29 04:06:16 +00:00
Rusty Russell 3e2dea221b common/msg_queue: make it a tal object.
This way there's no need for a context pointer, and freeing a msg_queue
frees its contents, as expected.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-29 04:06:16 +00:00
Rusty Russell 3c97f3954e daemon_conn: make it a tal object, typesafe callbacks.
It means an extra allocation at startup, but it means we can hide the definition,
and use standard patterns (new_daemon_conn and typesafe callbacks).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-29 04:06:16 +00:00
Rusty Russell 0e6aec081a gossipd: make sure that freeing peer closes connection to it.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-29 04:06:16 +00:00
Rusty Russell 88da956531 daemon_conn: don't expose daemon_conn_write_next.
No external callers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-29 04:06:16 +00:00
Rusty Russell 689d51cba5 common/daemon_conn: remove finished function.
For the moment, caller sets it manually.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-29 04:06:16 +00:00
Christian Decker 46b2e7502c bitcoin: If we fail to estimate the fee in testnet use the minfee
When developing in regtest or testnet it is really inconvenient to
have to fake traffic and generate blocks just to get estimatesmartfee
to return a valid estimate. This just sets the minfee if bitcoind
doesn't return a valid estimate.

Reported-by: Rene Pickhardt <@renepickhardt>
Signed-off-by: Christian Decker <@cdecker>
2018-10-29 03:20:08 +00:00
Rusty Russell 40943c9867 Update for latest bolt version: bca814e270dcbee2fea51c0a26ca99efef261f2b
The only change is that the final_incorrect_htlc_amount field is now 64
bit.  Since no implementation yet parses that field, we just updated it
quietly in the spec.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-28 23:51:05 +00:00
Rusty Russell c236361efd wireaddr: update bolt version, remove 'padding' from addresses.
Nobody used this, so it was removed from the spec.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-28 23:51:05 +00:00
Rusty Russell 8600ba403c wireaddr: remove handling for addr->type == ADDR_TYPE_PADDING
We used to use this for "no known address", but we don't any more.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-28 23:51:05 +00:00
Rusty Russell 171006d17c lightnignd: peer addr is never NULL, adjust new_peer.
We always have an addr entry in the db (though it may be an ephemeral socket
the peer connected in from).  We don't have to handle a NULL address.

While we're there, simplify new_peer not to take the features args;
the caller who cares immediately updates the features anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-28 23:51:05 +00:00
Rusty Russell aab91557f3 Travis: eliminate 4 slowest tests, with new SLOW_MACHINE flag.
In one case we can reduce, in the others we eliminated if VALGRIND.

Here are the ten slowest tests on my laptop:

469.75s call     tests/test_closing.py::test_closing_torture
243.61s call     tests/test_closing.py::test_onchain_multihtlc_our_unilateral
222.73s call     tests/test_closing.py::test_onchain_multihtlc_their_unilateral
217.80s call     tests/test_closing.py::test_closing_different_fees
146.14s call     tests/test_connection.py::test_dataloss_protection
138.93s call     tests/test_connection.py::test_restart_many_payments
129.66s call     tests/test_gossip.py::test_gossip_persistence
128.73s call     tests/test_connection.py::test_no_fee_estimate
122.46s call     tests/test_misc.py::test_htlc_send_timeout
118.79s call     tests/test_closing.py::test_onchain_dust_out

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-10-28 16:03:12 +01:00