Commit Graph

918 Commits

Author SHA1 Message Date
Rusty Russell 64bdee6b6e bitcoind: add helper for arg manip, make array a const char *.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-31 04:15:55 +00:00
Christian Decker 70514d1e95 cli: Add rpcuser, rpcpassword and rpcconnect to bitcoind
Might help alleviate some of the issues of having to run a full-node
on the same machine as `lightningd`.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-31 04:15:55 +00:00
Rusty Russell ca2f72fd5f log: block reporting on minor memleak.
Exception: Node /tmp/lightning-t5gxc6gs/test_closing_different_fees/lightning-2/ has memory leaks: [{'value': '0x55caa0a0b8d0', 'label': 'ccan/ccan/tal/str/str.c:90:char[]', 'backtrace': ['ccan/ccan/tal/tal.c:467 (tal_alloc_)', 'ccan/ccan/tal/tal.c:496 (tal_alloc_arr_)', 'ccan/ccan/tal/str/str.c:90 (tal_vfmt)', 'lightningd/log.c:131 (new_log)', 'lightningd/subd.c:632 (new_subd)', 'lightningd/subd.c:686 (new_peer_subd)', 'lightningd/peer_control.c:2487 (peer_accept_channel)', 'lightningd/peer_control.c:674 (peer_sent_nongossip)', 'lightningd/gossip_control.c:55 (peer_nongossip)', 'lightningd/gossip_control.c:142 (gossip_msg)', 'lightningd/subd.c:477 (sd_msg_read)', 'lightningd/subd.c:319 (read_fds)', 'ccan/ccan/io/io.c:59 (next_plan)', 'ccan/ccan/io/io.c:387 (do_plan)', 'ccan/ccan/io/io.c:397 (io_ready)', 'ccan/ccan/io/poll.c:305 (io_loop)', 'lightningd/lightningd.c:347 (main)', '(null):0 ((null))', '(null):0 ((null))', '(null):0 ((null))'], 'parents': ['lightningd/log.c:103:struct log_book', 'lightningd/lightningd.c:43:struct lightningd']}]

Technically, true, but we save more memory by sharing the prefix pointer
than we lose by leaking it.

However, we'd ideally refcount so it's freed if the log is freed and
all the entries using it are pruned from the log book.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-30 19:47:27 +00:00
Rusty Russell 57b423625b subd: use peer log for messages (if any).
This makes much more sense when you ask for a specific peer's log.
Also, we put the peerid rather than pid ().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-30 19:47:27 +00:00
Rusty Russell 1a297a7010 bitcoind: mark request no longer running, even if it fails.
We added code to allow a few spurious failures, but it didn't unmark
the request running.

IRC user 'mlz' (@molxyz) provided logs from his stuck-at-old-block lightningd:

lightningd(31981): Adding block 1261159: 00000000da3890ccd0f313a74fccfd4789654b496836da5c28a8d2ad28852264

lightningd(31981): Adding block 1261160: 00000000f70938a33aecbdd7b047cb5cf5b095ea4770c1335acf1859bad1e767

lightningd(31981): bitcoin-cli -testnet estimatesmartfee 2 CONSERVATIVE exited with status 1

Fixes: #749
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-30 15:19:45 +01:00
windsok de5d78a359 update references to sat/kb to sat/kw 2018-01-30 08:11:51 +00:00
Rusty Russell 6daa770b0e Minor whitespace/comment spelling fixes.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-29 06:01:56 +00:00
Christian Decker acc6afc8de gossip: Directly return an error if we don't know a node's address
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-29 06:01:56 +00:00
Christian Decker 61e982c6b7 gossip: Implement connection failed handler in lightningd
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-29 06:01:56 +00:00
Christian Decker f5147f27c9 gossip: Added message for unsuccessful connection attempts
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-29 06:01:56 +00:00
rvandermeer 4c0f7dbd04 Spelling corrections (#824)
* Small spelling fixes, and clarity for 'iff'

[ Squashed commit --RR ]
2018-01-29 04:46:54 +00:00
ZmnSCPxj 8f5584d7d6 peer_control: Correct roundoff of remote-side msatoshi.
Fixes: #818
2018-01-29 04:44:18 +00:00
practicalswift 689db5b7c1 Onboarding: Make log output texts friendlier to new users 2018-01-29 03:22:27 +00:00
Christian Decker 92ce3d5e8d opts: Declare --port to be an early arg
There is an interaction between --ipaddr and --port, namely that the
default port is used when parsing --ipaddr if --port comes after the
--ipaddr, and --port is used if it comes before it. Adding a port to
--ipaddr still trumps everything else, but this way we correctly set
port in the address.

Reported-by: Wladimir J. van der Laan @laanwj
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-29 03:21:25 +00:00
Luca Vaccaro af26c91a2c Add litecoin testnet support 2018-01-28 13:56:28 +01:00
ZmnSCPxj d03ca59f80 jsonrpc: Report standard JSON-RPC 2.0 error codes. 2018-01-27 14:32:06 +01:00
ZmnSCPxj e1d17e92e0 jsonrpc: Implement command_fail_detailed. 2018-01-27 14:32:06 +01:00
ZmnSCPxj 551dfedc4a jsonrpc: Internal: Support changing the error code internally. 2018-01-27 14:32:06 +01:00
ZmnSCPxj b2133e969f jsonrpc: Trivial compliance with JSON-RPC Error Object. 2018-01-27 14:32:06 +01:00
Christian Decker a7a6b4646a json-rpc: Remove alarming debug statement
People keep on stumbling over this, since it's rather alarming.

Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-27 02:27:35 +00:00
Ronald van der Meer 8e087c1d71 clarified lightning-cli help dev-setfees description 2018-01-26 03:00:29 +00:00
Christian Decker 6cfc0a6275 fixup! masterd: Disable a channel when channeld fails 2018-01-26 01:09:44 +00:00
Christian Decker e463386d75 masterd: Disable a channel when channeld fails
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-26 01:09:44 +00:00
Christian Decker c6ae4b521f gossip: Add message to enable and disable a channel
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-26 01:09:44 +00:00
Christian Decker d14969ce77 masterd: Peer has to know which direction an eventual channel is
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-26 01:09:44 +00:00
Rusty Russell 9f9c34002e chain_topology: log block height, not just hash.
Saves me a lookup.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-25 12:52:06 +01:00
Rusty Russell e9328217ff peer_control: better logging when we don't tell peer about locked funding.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-25 12:52:06 +01:00
Rusty Russell c42fa4404a connect: succeed if we connect to peer and it *doesn't* go back to gossipd.
The JSON connect command wouldn't terminate if peer reconnected
in a state CHANNELD_AWAITING_LOCKIN or above.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-25 12:52:06 +01:00
practicalswift b91556283b Onboarding: Adjust log level for common non-fatal peer state condition from info to debug 2018-01-25 00:28:47 +00:00
practicalswift 3a8220d630 Warn instead of crash when extract_feerate(...) fails
Fixes: #722
2018-01-25 00:16:14 +00:00
practicalswift 0557467dfa Adjust log level for feerate warnings
This condition seems to be triggered quite common on testnet, so no
need for warning floods unless we're running in debug mode :-)
2018-01-25 00:15:47 +00:00
Christian Decker 9588c961bb wallet: Forget channels that are irrevocably settled on-chain
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-25 00:14:23 +00:00
Rusty Russell 45665a994b htlc_end: allow htlc_out to have 0 msatoshi.
Such an htlc is invalid, and will be failed cleanly by our channeld
(which also checks that it meets the minimum amount), but it's
not the master's job to check it, and in fact, it asserts if we were
to try to pay or forward such a thing.

Fixes: #686
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-24 19:34:46 +01:00
Rusty Russell 3ccf88d6c4 lightningd: check channeld isn't trying to add 0-satoshi incoming HTLCs.
The peer shouldn't try, and channeld won't try to add it if it does,
but we shouldn't trust it.  And it would make our htlc_in_check() code
assert.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-24 19:34:46 +01:00
Carl Dong 8da65854f0 build: Add needed UNIX standard includes. 2018-01-23 16:10:19 +01:00
practicalswift 5631054152 Start all command descriptions with a verb ("Show", "Set", etc.). Remove unused help texts. 2018-01-23 13:32:44 +01:00
practicalswift 22087dad03 Adjust log level: Warn about ignored fee limits only in debug log 2018-01-22 19:23:23 +01:00
William Casarin f8e5de1974 listpeers: print channel configs
Signed-off-by: William Casarin <jb55@jb55.com>
2018-01-21 23:03:07 +01:00
Ephraim Raj 041b641161 Added that peer id should be given to dev-sign-last-tx 2018-01-20 17:57:04 +01:00
practicalswift 2f179fb6cb Don't greet new users with an error message
Before this patch:

```
$ lightningd/lightningd
lightningd(PID): Creating lightningd dir /root/.lightning (because chdir gave No such file or directory)
lightningd(PID): Creating database
```

After this patch:

```
$ lightningd/lightningd
lightningd(PID): Creating lightningd dir /root/.lightning
lightningd(PID): Creating database
```
2018-01-20 01:32:59 +01:00
Christian Decker 97447dd4c4 options: Dropping default base_fee for mainnet to 1 satoshi
Signed-off-by: Christian Decker <decker.christian@gmail.com>
2018-01-19 22:25:16 +00:00
Rusty Russell 8797159825 Use consistent names for timestamps.
Old fields still there, just deprecated.

Invoice commands:
	paid_timestamp -> paid_at
	expiry_time -> expires_at

decodepay:
	timestamp -> created_at

getlog:
	creation_time -> created_at

listpayments:
	timestamp -> created_at

Suggested-by: @shesek
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 4f1dc91ba5 lightningd: rename --deprecated-apis to --allow-deprecated-apis.
Suggested-byL practicalswift
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 5e0a5c9111 JSONRPC: delinvoice: have a status argument.
delinvoice was orginally documented to only allow deletion of unpaid
invoices, but there might be reasons to delete paid ones or unexpired ones.

But we have to avoid the race where someone pays as it's deleted: the
easiest way is to have the caller tell us the status, and fail if
it's wrong.

Fixes: #477
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 2443d45b47 delinvoice: fixes.
Error code is inverted (which makes sense: who returns 'true' on
error?), and anyway there's a leak if we do error.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell c8c68cfb7c JSONRPC: listpeers multiple channels, output improvements.
We're going to have to support multiple channels per peer, even if only
when some are onchain.  This would break the current listpeers, so
change it to an array (single element for now).

Other cleanups:

1. Only set connected true if daemon is not onchaind.
2. Only show netaddr if connected; don't make it an array, call it `address`
   in comparison with `addresses` in listnodes.
3. Rename `channel` to `short_channel_id`
4. Add `funding_txid` field for voyeurism.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell bd010d4b96 listinvoices: deprecate 'complete' in favor of 'status' trinary.
[ Manpage regen fixup by Christian Decker ]
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 8dfbfa2069 dev-ping: use id not peerid as argument name.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell 2f2cacef0d JSONRPC: output from listpeers should be 'id' not 'peerid'.
That's what we use everywhere else.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00
Rusty Russell cf54f23947 JSONRPC: add id argument to listpeers.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-01-19 22:23:45 +00:00