Commit Graph

2689 Commits

Author SHA1 Message Date
Rusty Russell e1e7f289fb JSONRPC listnodes: return timestamp, alias and color.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 784ec96841 gossip: save alias from node_announcement
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell ced572b973 JSONRPC: getnodes: rename to listnodes.
Like listinvoice, and add optional 'id' parameter to ask about a
specific node.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell e745572dfb JSONPRC: decodepay: print 'c' value.
If they want to call getroute manually, they'll need this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 461207b886 getroute: document cltv argument.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 6b740e78bd json: more sanity checks on JSON output.
We should never have an unnamed element, nor an named array field.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 1f6392fa83 lightningd: --deprecated-api option to turn off deprecated APIs.
This can be used for upgrades to make sure you're not using deprecated
options, JSON commands, JSON fields, etc.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 5a06b665bd channeld: don't consider shutdown complete if feechange pending.
Travis gave an error:

```
DEBUG:root:lightningd(16333): lightning_closingd(8004): STATUS_FAIL_PEER_BAD: Expected closing_signed:
0085b679bd79b836b05c649cad9af31156cb1d50de448a59c6359ab7c85f4b63913d2e3bc8ad4a80ab698558e5b4949b78dc36acc90dde4f5ac006fd6ca1d109feea03aef9c718e9ce09bbb52dc8308ba8f46b43808ea1a551d41aee72af7af77628d1
```

Which is caused by us not waiting for the revoke-and-ack from a feechange
when we're shutting down.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 16:11:55 +01:00
ZmnSCPxj d2789fd647 wallet: Properly save `wallet_payment::path_secrets`.
Fixes: #657
2018-01-19 14:33:49 +01:00
practicalswift a08b6fffc6 Add consistency check for dependencies listed in README.md and doc/INSTALL.md 2018-01-19 10:11:19 +00:00
practicalswift 5357a6f02d Sync dependencies between README.md and doc/INSTALL.md
Before this patch:

```
$ diff -u <(egrep 'sudo apt-get install .*git' README.md) <(egrep 'sudo apt-get install .*git' doc/INSTALL.md)
--- /dev/fd/63    2018-01-18 17:26:34.330464546 +0100
+++ /dev/fd/62    2018-01-18 17:26:34.330464546 +0100
@@ -1 +1 @@
-sudo apt-get install -y autoconf build-essential git libtool libgmp-dev libsqlite3-dev python python3 net-tools
+sudo apt-get install -y autoconf automake build-essential git libtool libgmp-dev libsqlite3-dev python python3 net-tools
$
```

After this patch:

```
$ diff -u <(egrep 'sudo apt-get install .*git' README.md) <(egrep 'sudo apt-get install .*git' doc/INSTALL.md)
$
```
2018-01-19 10:11:19 +00:00
renepickhardt 69260adb38 quickfixing issue #662 to make CLI more userfriendly for inexperienced users (#663)
* making the cli more user friendly for inexperienced users #662

providing a quickfix for https://github.com/ElementsProject/lightning/issues/662

Basically I extended the ./lighting-cli --help message to at least state that one should use ./lighting-cli help, and added a hint to cli/lighting-cli help to the README

Closes: #662
2018-01-19 10:09:54 +00:00
Christian Decker ced486e727 jsonrpc: Add the network name to the getinfo output
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-18 23:34:51 +01:00
Christian Decker f298c6b03e doc: Adding generate listpayments man page 2018-01-18 20:53:11 +01:00
practicalswift aefc887521 Fix typos 2018-01-18 20:50:07 +01:00
ZmnSCPxj 7b6a16a3a6 invoices: Do not load `pay_index` if not PAID.
`pay_index` has no valid value if not PAID anyway, so
we should correctly leave it uninitialized.
Analysis via valgrind will catch incorrect use of
uninitialized fields.
If we load it with a dummy 0 value, then an
incorrect use of `pay_index` whan invoice is not
PAID will not get caught by valgrind.
2018-01-18 17:37:10 +01:00
ZmnSCPxj a88c73a41b invoices: Add `paid_timestamp` field.
Fixes: #615
2018-01-18 17:37:10 +01:00
audiojak 5a87fb1c3b Minor gramatical fixes 2018-01-18 11:42:57 +01:00
ianthius 988118a629 Update README.md
Python is needed here as it looks like on newer versions of Ubuntu (i am on 16.04) it's not included by default.
2018-01-18 11:42:07 +01:00
ianthius 2d5c958617 Python is a needed dependency here
Make seems to require python as well as python3.
2018-01-18 11:41:56 +01:00
practicalswift 5697332677 Avoid potential NULL pointer dereference in wallet_payment_store(...) 2018-01-18 11:41:45 +01:00
ZmnSCPxj, ZmnSCPxj jxPCSmnZ a06f0dfeb1 Make `fundchannel` return txid too
For voyeurism.

Fixes: #402
2018-01-18 02:03:28 +00:00
Rusty Russell 9ed7041c46 bitcoind: if callback says don't call on error, dont.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 15aaf9f49a test_lightning.py: shutdown tail thread before killing.
Seems to avoid the nasty python resource warnings, as well as the
fatal 'ValueError: PyMemoryView_FromBuffer(): info->buf must not be NULL'

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 4b178621e2 test_lightningd.py: test that payments are pending even before HTLC committed.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell b81129f87e wallet: fix case of failed payment not yet in db.
From test_reconnect_sender_add1:

lightningd(13643):BROKEN: backtrace: wallet/wallet.c:1537 (wallet_payment_set_status) 0x561c91b03080
lightningd(13643):BROKEN: backtrace: lightningd/pay.c:67 (payment_failed) 0x561c91ac4f99
lightningd(13643):BROKEN: backtrace: lightningd/peer_htlcs.c:132 (fail_out_htlc) 0x561c91acf627
lightningd(13643):BROKEN: backtrace: lightningd/peer_htlcs.c:321 (hout_subd_died) 0x561c91acfb62

When payment fails, we call wallet_payment_set_status; this is perfectly
possible before it's been committed.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 38e8601cf6 wallet: abstract away delayed entry of wallet_payment.
For performance, we delay entering the 'wallet_payment' into the db
until we actually commit to the HTLC (when we have to touch the DB
anyway).

This opens a race where we can try to pay twice, and since it's not in
the database yet, we don't notice the duplicate.

So remove the temporary payment field from htlc_out, which was always
an uncomfortable hack, and make the wallet code abstract over the
deferred entry a little by maintaining a 'unstored_payments' list
and incorporating that in results.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 469faa476e test_lightning.py: test for persistence.
Also note that failing an in-progress payment (instead of waiting) is
pretty weird.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 6ba1bc5c93 channeld: repopulate HTLC shared secrets on reinitialization.
We could do this lazily, if HTLC errors out, but we do it as HTLCs
come in in the normal case, so this is slightly simpler.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 02e05ba6ff pay: remove struct pay_command.
It's all in wallet_payment, which is persistent.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell ae1d72b978 wallet: add routine to delete a payment.
We do this instead of updating, if we've got an old failed one.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 0f8f273410 lightningd: move cmd pointer from struct pay_command directly into htlc_out.
Set if a command is responsible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 559010f525 wallet: add path_secrets to payment table.
We need these to decode any returned errors.

We remove it from struct pay_command too, and load directly from db
when we need it.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 9b99b74c41 db: route to extract an array of struct secret from a column.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Rusty Russell 2cbe5b65c7 wallet: add preimage to db.
We should be saving this, as it's our proof of payment.  Also, we return
it if they try to pay again.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 23:55:35 +01:00
Björge Dijkstra d1b2a97146 Fix unitialized fields in htlc_out constructed from wallet database entry 2018-01-17 23:55:35 +01:00
Rusty Russell 3fbed24b0d wallet: remove direction column from payments table.
We simply discard incoming entries.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 22:43:14 +01:00
Rusty Russell dea0aef52f wallet: use wallet_payment only for *outgoing* payments.
Incoming payment information is completely covered by invoices.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-17 22:43:14 +01:00
Eric Martindale 575b733edd Fix paren in README, add `autoconf` to dependencies 2018-01-17 16:22:44 +01:00
ZmnSCPxj, ZmnSCPxj jxPCSmnZ be0b76f03d INSTALL.md: Add `automake` as dependency.
Fixes: #624
2018-01-17 16:17:32 +01:00
Filipe Farinha b13c65dacb withdraw: Swap 'satoshi' and 'destination' params to match online help. 2018-01-17 00:51:18 +01:00
windsok 710e91f255 update invoice manpage to match current RPC and CLI interface 2018-01-16 13:15:32 +01:00
ZmnSCPxj 93dc90990f invoices: Extensive reorganization of invoice system. 2018-01-16 13:03:54 +01:00
Christian Decker ad5eb1f7e1 pytest: Skip test_fee_limits for DEVELOPER=0
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-16 12:22:06 +01:00
Rusty Russell 79dc44713b channeld: --ignore-fee-limits as a hack for fee disparities.
This, of course, should never be used.  But it helps maintain connections
for the moment while we dig deeper into feerates.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-16 12:22:06 +01:00
practicalswift e91a8dff12 Change log level for some common debug messages from "info" to "debug" 2018-01-16 03:20:27 +00:00
practicalswift 145e26371d Add test for too-short decodepay (credit: @ZmnSCPxj) 2018-01-15 19:32:00 +00:00
practicalswift a87c8a74b5 Avoid segfault on CLI command "decodepay 1111111" (invalid short bech32 string)
Before this patch:

```
$ cli/lightning-cli decodepay 1111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 11111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 1111111
lightning-cli: Non-object response ''
$ cli/lightning-cli decodepay 1111111
lightning-cli: Connecting to 'lightning-rpc': Connection refused
```

After this patch:

```
$ cli/lightning-cli decodepay 1111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 111111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 11111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 1111111
"Invalid bolt11: Bad bech32 string"
$ cli/lightning-cli decodepay 1111111
"Invalid bolt11: Bad bech32 string"
```
2018-01-15 19:32:00 +00:00
Christian Decker 5319ff1bc0 bitcoind: Do not crash when getblock fails
This is a common occurence on pruned nodes. By calling the callback
upon failures, we communicate that we couldn't verify the txoutput. We
fail safe rejecting any channel we can't verify.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-15 19:29:01 +00:00
Rusty Russell 4b663e596a lightningd: don't crash when txout lookup fails.
Gossipd already correctly handles the "empty output means lookup failed" case.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-15 19:29:01 +00:00