Commit Graph

3060 Commits

Author SHA1 Message Date
Christian Decker b4ce4d228d JSON-RPC: Fix unquoted error string when parser fails
Fixes #963

Reported-by: @shesek
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-13 12:01:27 +01:00
practicalswift fe670b9aaa Improve log message when receiving unknown message type 2018-02-12 09:31:00 +01:00
ZmnSCPxj 4e382ebd94 doc: Mention keyword arguments, update pay to mention use of null. 2018-02-12 09:30:16 +01:00
Rusty Russell 6757300a0e Travis: slightly more finegrained, should be under 17 minutes now.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-12 09:27:49 +01:00
Rusty Russell 106c8304f6 Travis: don't perform source-check on every build variant.
Run it in a separate job, first.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-12 09:27:49 +01:00
Rusty Russell b4a2f51384 Travis: use more fine-grained tests.
Currently valgrind developer tests are taking about 25 minutes,
with the non-developer valgrind taking 32.

Split into 6 parts and 2 parts respectively.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-12 09:27:49 +01:00
danielalexiuc fa8bcf2230 Include apt-get update as first step
For the impatient! First time users following these steps may get an error like "Unable to locate package libsodium-dev" if apt-get update is not run first.
2018-02-12 09:24:45 +01:00
Christian Decker cb97dfec4e gossip: Fix up some comments on PR #955
Just some minor things that were suggested during review.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-11 11:40:59 +01:00
Christian Decker 96667a3028 fixup! pytest: Test storing last_htlc_sigs and onchaind fund recovery 2018-02-11 01:13:07 +01:00
Christian Decker ea9aa95625 pytest: Test storing last_htlc_sigs and onchaind fund recovery
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-11 01:13:07 +01:00
Christian Decker 37b96e9c95 wallet: Load any stored htlc_sigs when restoring channel
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-11 01:13:07 +01:00
Christian Decker 9f8f0ccec9 peer: Store htlc_sigs when they are updated
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-11 01:13:07 +01:00
Christian Decker 3bb619fee4 wallet: Add primitive to store htlc_sigs in the database
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-11 01:13:07 +01:00
Christian Decker e1c0119373 db: Add table for htlc_sigs
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-11 01:13:07 +01:00
Christian Decker 68639db7db JSON-RPC: Add funds in channels to `listfunds`
This caused a bit of confusion for our testers, when funding a channel
the funds are no longer available and listed in `lisfunds`, causing
them to believe funds to have disappeared. This PR adds funds that are
allocated to channels in the `listfunds` output, together with some
info about the channel, to make sure this doesn't happen again.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-10 22:35:21 +00:00
Jeff Weiss 97871237bf README - change number of confirmations needed in fundchannel to 3
For mainnet, 1 for testnet
2018-02-10 22:44:07 +01:00
Jeff Weiss 5d947b3a1f README - note that bitcoind node pruning is not yet supported 2018-02-10 22:44:07 +01:00
root 73022d91c6 Fix indentation 2018-02-10 21:30:46 +01:00
root 8b0ed27c43 Add optional from id parameter to getroute call. 2018-02-10 21:30:46 +01:00
Christian Decker 5a133d2d70 json-rpc: Return a standard compliant error when parsing fails
The JSON-RPC spec specifies that if the request is unparseable we
should return an error with a NULL id. This is a bit more friendly
than slamming the door in the face.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-10 15:44:14 +01:00
Christian Decker e92e26f84d json-rpc: Check for unprintable characters in JSON-RPC commands
As reported by @practicalswift in #945 it is possible to inject
non-printable, or shell escape, characters in a json command, that
will fail to parse and then clear the shell.

Reported-by: @practicalswift
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-10 15:44:14 +01:00
Christian Decker 16004684c9 wallet: Make the linter happy about int vs size_t comparison
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-10 14:20:15 +01:00
Christian Decker 8a68646395 wallet: Add deprecated and verbose help to walletrpc commands
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-10 14:20:15 +01:00
Christian Decker e5b6fed395 wallet: Mark some parameters as unused
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-10 14:20:15 +01:00
ZmnSCPxj fecfd55e06 routing: Suppress UNUSUAL log message for UPDATE failcodes from local. 2018-02-09 15:13:49 +01:00
Rusty Russell d5effcb961 test_lightning: fix race on testing, esp. test_closing_different_fees.
We get intermittant failure: WIRE_UNKNOWN_NEXT_PEER (First peer not ready)
because CHANNELD_NORMAL and actually telling gossipd that the channel
is available are distinct things: we need both.

(For test_closing_different_fees, we were testing CHANNELD_NORMAL on
the peer, not on l1, too).

But we may also directly send the announcement sigs if the height is
sufficient, so the simplest is to unify the messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-09 13:01:19 +01:00
ZmnSCPxj 203c222f57 doc: Update to add fee limit to pay. 2018-02-09 12:44:33 +01:00
ZmnSCPxj 354fafbf60 pay: Add a limit to the fee.
Fixes: #717
2018-02-09 12:44:33 +01:00
ZmnSCPxj e1284b1df1 common/json: Add json_add_double. 2018-02-09 12:44:33 +01:00
practicalswift 2a979a2d5c Fix typos 2018-02-08 23:33:49 +01:00
practicalswift 4f4756bd20 Fix a-vs-an typos 2018-02-08 22:49:34 +01:00
practicalswift 5474512c31 Add assertion to clarify assumption made in order to avoid UB 2018-02-08 19:31:18 +01:00
Rusty Russell eb0603bd13 wireaddr: rework port parsing for weird addresses.
We save wireaddr to databases as a string (which is pretty dumb) but
it turned out that my local node saved '[::ffff:127.0.0.1]:49150'
which our parser can't parse.

Thus I've reworked the parser to make fewer assumptions:
parse_ip_port() is renamed to separate_address_and_port() and is now
far more accepting of different forms, and returns failure only on
grossly malformed strings.  Otherwise it overwrites its *port arg only
if there's a port specified.  I also made it static.

Then fromwire_wireaddr() hands the resulting address to inet_pton to
figure out if it's actually valid.

Cc: William Casarin <jb55@jb55.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:14:21 +01:00
Rusty Russell cc9ca82821 status: separate types for peer failure vs "impossible" failures.
Ideally we'd rename status_failed() to status_fatal(), but that's
too much churn for now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Rusty Russell fd498be7ca status: generate messages rather than marshal/unmarshal manually.
Now we have wirestring, this is much more natural.  And with the
24M length limit, we needn't be so concerned about dumping 64k peer
messages in hex.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Rusty Russell c7b693d7ce status: remove unused status_send_sync.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Rusty Russell 780b620cb1 openingd: use wirestring instead of u8 array for why negotiation failed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Rusty Russell b7db06b577 tools/generate-wire.py: wirestring type for handing strings.
A convenient alias for char *, though we don't allow control characters
so our logs can't be fooled with embedded \n.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Rusty Russell 9a6c36a568 bitcoin/tx: remove unused pull_bitcoin_tx_onto.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Rusty Russell 674a2c7554 tools/generate_wire.py: make bitcoin_tx a varlen structs
Now it allocates naturally.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Rusty Russell 526d3a232e tools/generate_wire.py: generate varlen arrays properly.
These are now logically arrays of pointers.  This is much more natural,
and gets rid of the horrible utxo array converters.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Rusty Russell ad8dfaca1c tools/generate_wire.py: make varlen structs self-allocate.
If we tell it a struct is variable length, make fromwire() allocate
and return it off ctx.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Rusty Russell 6ca0c6e0ec test_lightningd: race fix for activation of channels in test_gossip_jsonrpc
```
>       assert [c['active'] for c in l2.rpc.listchannels()['channels']] == [True, True]
E       AssertionError: assert [True, False] == [True, True]
E         At index 1 diff: False != True
E         Full diff:
E         - [True, False]
E         + [True, True]
```

We don't actually wait that l2's gossipd has also processed the message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-02-08 19:07:12 +01:00
Christian Decker e04619457b master: Don't crash if peer reconnects before we activate it
`activate_peer` does little more than wiring up some txwatches and
asking `gossipd` to reconnect to the peer. If the peer manages to
reconnect before we activate then we would crash.

This just changes the `assert` causing the crash into a conditional
whether we need to reconnect or not.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-08 01:07:59 +00:00
luca vaccaro 7da942dec8 Fix dev-rescan-outputs crash on 0 outputs (#944)
Fix dev-rescan-outputs crash on 0 outputs
2018-02-08 01:06:52 +00:00
ZmnSCPxj d666857aed pay: Recover from unparseable routing failures by random disabling of channels.
Fixes: #868

Not pretty, but workable.
2018-02-08 00:51:30 +00:00
ZmnSCPxj 0d0ef2c733 gossipd: Implement gossip_mark_channel_unroutable.
Temporarily marks a channel as unroutable.
2018-02-08 00:51:30 +00:00
Christian Decker b3d4e161b5 pytest: Add test for `dev-forget-channel`
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-07 00:47:13 +00:00
Christian Decker d05e8ed695 jsonrpc: Add a dev-forget-channel command to remove stale channels
Due to the broadcast failure quite a few users are reporting channels
stuck in awaiting lockin. This commit adds a `dev-forget-channel`
command that checks whether the funding outpoint is in the UTXO, and
forgets the channel if not. The UTXO check can be overridden with the
`force` parameter, but that is dangerous.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-07 00:47:13 +00:00
Christian Decker 4f5c47b43b wallet: Do not consider OPENINGD channels as active
Still writing the channel since some of the channel setup parameters
depends on `chan->id` to be set. If we later set the `chan->id`
signatures fail. This prevents OPENINGD channels showing up after
restarting.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-02-07 00:47:13 +00:00