Commit Graph

3027 Commits

Author SHA1 Message Date
Rusty Russell f527f39613 test_lightning: add tests for closing with differetn feerates.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 20:33:49 +01:00
Rusty Russell 191e7f4c5c lightningd: add more debugging info for closing.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 20:33:49 +01:00
Rusty Russell a0f924376f channeld: don't send update_fee after shutdown.
See: https://github.com/lightningnetwork/lightning-rfc/pull/367
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 20:33:49 +01:00
alaniz b7856e3512 Onboarding: tweak grammar conventions for RPC responses 2018-02-02 06:16:23 +00:00
Jon Griffiths 505a249966 push_tx: Don't create BIP 144 invalid transactions
If no witnesses are present on any inputs, then extended serialisation
should not be used.

[ Amended to make adding new flags clearer in future -- RR ]
Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 02:33:13 +00:00
ZmnSCPxj ff1a466ef3 devtools/.gitignore: Ignore decodemsg. 2018-02-02 01:49:30 +00:00
Rusty Russell fff7dd0826 devtools/decodemsg: new tool.
$ ./devtools/decodemsg 00110000000000000000000000000000000000000000000000000000000000000000000e496e7465726e616c206572726f72
WIRE_ERROR:
channel_id=0000000000000000000000000000000000000000000000000000000000000000
data=[Internal error]

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:57:10 +00:00
Rusty Russell 32abb4d928 tools/generate-wire.py: --printwire option to create print routines.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:57:10 +00:00
practicalswift d09fc71456 Rename log_default_print to log_to_stdout 2018-02-02 00:55:38 +00:00
practicalswift 2c03be11b6 Unify log_to_file(...) and log_default_print(...) 2018-02-02 00:55:38 +00:00
practicalswift ebef98d8be Create log timestamp string from log entry data 2018-02-02 00:55:38 +00:00
practicalswift 3696e1b607 Usability: Prefix logging to stdout with ISO 8601 formatted date and time in UTC 2018-02-02 00:55:38 +00:00
Rusty Russell d1ab2e05f4 test_lightningd.py: test lightning-cli.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 91a22dc496 jsonprc: make json_get_params() fail the command, for better error reporting.
We move it into jsonrpc where it belongs, and make it fail the command.
This means it can tell us exactly what was wrong.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 47577e5c4e jsonrpc: check that arguments to calls are valid.
This change could break users who accidentally have typos in scripts,
so we need to check sooner rather than later.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell c3bd78433f lightning-cli: keyword mode.
By default, autodetect, but that's unreliable, so use -k/-o to force
interpretation.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 327e2b8fd8 JSONRPC: listconfigs command.
With the new 'human-readable' mode of lightning-cli, this actually produces
a valid config file.  It's a bit hacky though...

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 0600aac68f lightningd: rename --no-reconnect to --dev-no-reconnect.
It's a dev option.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell bd3480dc9c lightningd: remember --log-file arg.
And fclose old ones if we get handed it multiple times.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 7fd5808803 contrib/lightning-cli.bash-completion: fix for new simpler help format.
Plus, we don't need awk *and* sed for this!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 7d18ef9ecf lightning-cli: human-readable printing for help.
And make it an option for now for other commands; consider making
it the default.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 1ee44bdb47 jsonrpc: verbose help for help command.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 27678dfe6a jsonrpc: add verbose help for individual commands.
And beg for contributions!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
Rusty Russell 7f03e15e03 json_add_string_escape: for escaping internally-generated strings.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-02 00:05:00 +01:00
cornwarecjp 6112df3a90 Bring back the time-out on the start-up of bitcoind, but make it 60 seconds instead of the original 10 seconds. This is much larger than the normal start-up time of bitcoind (so we should never hit the time-out), but still lets a test terminate in a reasonable time in the unlikely case that bitcoind hangs. 2018-02-01 23:00:43 +01:00
cornwarecjp 896f7ef37d Make it possible to run the test suite in Python 3.4 (bytes.hex was introduced in 3.5) 2018-02-01 23:00:43 +01:00
cornwarecjp 0b0708d86a Bitcoind should always eventually finish starting, but there is no guarantee on how long it takes, so don't apply a time-out. In case bitcoind hangs indefinitely, the test will hang indefinitely too, but this should be solved in bitcoind, not in the test code. 2018-02-01 23:00:43 +01:00
cornwarecjp 859070a5ed Terminate LightningD if, for some reason, it doesn't start properly. This cleans up the environment for future test runs. 2018-02-01 23:00:43 +01:00
cornwarecjp 71581ff96e Terminate BitcoinD if, for some reason, it doesn't start properly. This cleans up the environment for future test runs. 2018-02-01 23:00:43 +01:00
Rusty Russell 0cef23d33a check-spelling: don't paginate, and give file and line.
The pagination causes it to wait for a keypress even with no output
under emacs (complaining about the terminal); we don't want it anyway.

Example output:

Makefile:228:#lighnting!
Identified a likely misspelling of the word "lightning" (see above). Please fix.
Is this warning incorrect? Please teach tools/check-spelling.sh about the exciting new word.
Makefile:230: recipe for target 'check-spelling' failed

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-01 14:40:31 +01:00
Rusty Russell 8fcb45c1b2 routing: use marshalled short_channel_id, not string as tag for channel_announce
We use this technique for the other tags, so use it here too.

This was drawn to my attention when I made more than 10 channels in a
block, and the string changed length:

 Valgrind error file: valgrind-errors.31415
==31415== Conditional jump or move depends on uninitialised value(s)
==31415==    at 0x4C35E20: bcmp (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==31415==    by 0x11A624: queue_broadcast (broadcast.c:40)
==31415==    by 0x118D93: handle_pending_cannouncement (routing.c:704)
==31415==    by 0x1109E3: handle_txout_reply (gossip.c:1796)
==31415==    by 0x111177: recv_req (gossip.c:1955)
==31415==    by 0x136723: next_plan (io.c:59)
==31415==    by 0x137220: do_plan (io.c:387)
==31415==    by 0x13725E: io_ready (io.c:397)
==31415==    by 0x138B97: io_loop (poll.c:305)
==31415==    by 0x111352: main (gossip.c:2022)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-01 12:20:15 +01:00
Rusty Russell 3d91bf2ab8 closingd: use common/read_peer_msg.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-01 05:57:56 +00:00
Rusty Russell 89e8d26f45 openingd: use common/read_peer_msg.
We need to override the err_pkt handler, so we can tell the master
that it's just a current-channel negotiation failure.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-01 05:57:56 +00:00
Rusty Russell 6dee526074 channeld: don't handle packets already taken by peer_msg_in.
We will never see them.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-01 05:57:56 +00:00
Rusty Russell c69aee7d7a channeld: use common/read_peer_msg.
We need to override two methods: the io error (tell gossipd to
disable), and send reply (enqueue, don't write direclty).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-01 05:57:56 +00:00
Rusty Russell ef9b16399c common: read_peer_msg helpers for per-peer subds.
It's a bit ugly because each caller has slightly different needs, but
we have three hooks and standard helpers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-01 05:57:56 +00:00
Rusty Russell bbdab02e1b bitcoind: trivial cleanups.
Remove commented-out code, and unnecessary tmpctx.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-01 03:12:43 +00:00
Christian Decker 3b9b7dc9dc wallet: Add a simple txo rescan command to sync with bitcoind UTXO
So many channels stuck in channeld_awaiting_lockin, and I don't like
suggesting manually editing the DB, so this adds a very simple way to
sync with bitcoind's UTXO view. `dev` since it is dangerous, then
again if bitcoind says those funds aren't available there's little we
can do anyway.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-01 03:12:43 +00:00
Christian Decker 11404f808e bitcoind: Disentangle gettxout from the scid verification
We may need to lookup UTXO entries for other reasons, so here we
disentangle it and make it into its own method.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-01 03:12:43 +00:00
ZmnSCPxj 87726d5b89 test_lightningd: Add test for reporting routing failures 2018-02-01 00:46:06 +00:00
ZmnSCPxj a043d1063a pay: Also report local channel failures to gossipd. 2018-02-01 00:46:06 +00:00
ZmnSCPxj 131283af6e test_lightningd: Move 0-payment test to its own test. 2018-02-01 00:46:06 +00:00
ZmnSCPxj 579011e980 pay: Report routing failures to gossip. 2018-02-01 00:46:06 +00:00
ZmnSCPxj c46727604e peer_htlcs: Prevent htlc_out from being handled multiple times in case of immediate channeld error. 2018-02-01 00:46:06 +00:00
ZmnSCPxj bd5dd46c4f peer_htlcs: Add missing assignment to hout->failcode. 2018-02-01 00:46:06 +00:00
ZmnSCPxj b2d8efcf25 pay: Move setting failed status on payment to after we get payment details. 2018-02-01 00:46:06 +00:00
ZmnSCPxj 67e2275383 gossipd: Add handling of channel_update to routing failures. 2018-02-01 00:46:06 +00:00
ZmnSCPxj 299b280f78 pay: Save nodes and channels used on route to payment. 2018-02-01 00:46:06 +00:00
ZmnSCPxj b255d82ae2 gossipd: Implement `gossip_routing_failure` for master to report routing failures. 2018-02-01 00:46:06 +00:00
Christian Decker 7a651c62fa gossip: Pull up the check for new channels before checking the txout
We drop all but the first announcement, so any work that is done for a
channel that we already know is wasted. Pulling this up duplicates
some of the work but allows us to skip the costly txout check.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-01 00:12:43 +00:00