Commit Graph

3431 Commits

Author SHA1 Message Date
ZmnSCPxj
3c39bcc0f7 pay: Make json_add_payment_fields accessible to other parts. 2018-03-19 00:27:55 +00:00
ZmnSCPxj
7443bf5ed5 doc: Update for latest 'pay' command. 2018-03-19 00:27:55 +00:00
ZmnSCPxj
d181ecbeea payalgo: Implement retry_for for pay command. 2018-03-19 00:27:55 +00:00
ZmnSCPxj
981af478f1 payalgo: Keep and report route and route failures. 2018-03-19 00:27:55 +00:00
ZmnSCPxj
234d67da34 channel_fail_permanent: Use a channel-level error, not an all-channels error.
Fixes: #1229
2018-03-17 13:26:58 +01:00
ZmnSCPxj
d49915cdd2 peer_control: Have listpeers also return channel ID. 2018-03-17 13:26:58 +01:00
ZmnSCPxj
099acb2a66 opening_control: have fundchannel also return channel_id.
For voyeurism.
2018-03-17 13:26:58 +01:00
Rusty Russell
4ffd5e213b pay: work around bug #1212 for existing databases.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 04:01:06 +00:00
Rusty Russell
1b9791f0f5 pay: delete HTLC when we delete payment.
This fixes the root cause of https://github.com/ElementsProject/lightning/issues/1212
where we deleted the payment because we wanted to retry, then retry failed
so we had an (old) HTLC without a matching payment.  We then fed that
HTLC to onchaind, which tells us it's missing, and we try to fail the
payment and deref a NULL pointer.

Fixes: #1212
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 04:01:06 +00:00
Rusty Russell
d8cecf03dd test_lightningd.py: add test to trigger crash bug.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 04:01:06 +00:00
ZmnSCPxj
e6de41b468 tools/rel.sh: Make POSIXLY compatible.
Fixes: #1221

We were using `\x0` to match NUL chars in the input (on the
assumption that NUL chars are "impossible" for decent LFS-compliant
systems).
However `\x0` is a GNUism.
Use the `\n` and the newline character, which is supported by (most)
POSIX sed.
2018-03-16 01:50:26 +00:00
ZmnSCPxj
7bbc1948f7 chaintopology: Add missing block_map_del.
We would `block_map_add` inside `add_tip`, but we never
`block_map_del` inside `remove_tip`, which is dangerous as
we actually `tal_free` the block inside `remove_tip`.

Our CI did not reliably trap this problem since block
hashes are random and rerunning the `test_blockchaintrack`
often passed spuriously.
2018-03-16 01:45:08 +00:00
ZmnSCPxj
39d8f64226 doc: Update manpages for change in return value. 2018-03-16 01:24:43 +00:00
ZmnSCPxj
f2aa15ffee test_lightningd.py: Check additional fields of sendpay. 2018-03-16 01:24:43 +00:00
ZmnSCPxj
022cfccddd pay: sendpay and waitsendpay print similar to listpayments 2018-03-16 01:24:43 +00:00
ZmnSCPxj
fa281d32ea pay: sendpay_result has payment on success or in-progress. 2018-03-16 01:24:43 +00:00
practicalswift
8f76581005 Use pointer to const where possible 2018-03-16 01:17:40 +00:00
practicalswift
c85c2fcfe9 Fix conversion order 2018-03-16 01:17:40 +00:00
practicalswift
b8846dad49 Readability: Use streq instead of strcmp 2018-03-16 01:17:40 +00:00
practicalswift
60a7720a24 Avoid passing NULL argument to memcpy 2018-03-16 01:17:40 +00:00
practicalswift
f0667d239a Remove duplicate va_end(...) call. va_end(...) is the responsibility of the caller. 2018-03-16 01:17:40 +00:00
practicalswift
f9bd43f266 Limit scope of variable failcode. Remove dead code. 2018-03-16 01:17:40 +00:00
practicalswift
b557e7b0fc Fix misleading indentation (space before tab) 2018-03-16 01:17:40 +00:00
practicalswift
7bd1ae6b2e Fix misleading indentation (in the case of DEVELOPER) 2018-03-16 01:17:40 +00:00
practicalswift
b206aed371 Remove redundant cast to same type 2018-03-16 01:17:40 +00:00
practicalswift
03e2e404f2 Mark unused parameters as such (using "UNUSED") 2018-03-16 01:17:40 +00:00
practicalswift
20ae038080 Remove redundant declaration 2018-03-16 01:17:40 +00:00
practicalswift
9970419b3a Remove redundant return from void function 2018-03-16 01:17:40 +00:00
Rusty Russell
a935ae0711 doc: Link STLYE.md from HACKING.md
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
08f4d48b0f Add some Style.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
e63b7bb539 take: allocate temporary variables off NULL.
If we're going to simply take() a pointer, don't allocate it off a random
object.  Using NULL makes our intent clear, particularly with allocating
packets we're going to take() onto a queue.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
0a6e3d1e13 utils: remove tal_tmpctx altogether, use global.
In particular, we now only free tmpctx at the end of main().

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
40fe5b7bac closingd: use global tmpctx.
This one is a bit more subtle than others: we can't just free it
inside the read_peer_msg() loop since we hand tmpctx in, so open-code
the two callers and it's clearer.

They're inside the only loops closingd has.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
f2adb76d04 test: remove obsolete directory.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
de5d84097e lightningd: remove ltmp context now we have tmpctx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
ccc9414356 status: remove trc context now we have tmpctx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
4845445079 memleak: ignore tmpctx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
ef2a063169 utils: add a global tmpctx.
I did a brief audit of tmpctx uses, and we do leak them in various
corner cases.  Fortunely, all our daemons are based on some kind of
I/O loop, so it's fairly easy to clean a global tmpctx at that point.

This makes things a bit neater, and slightly more efficient, but also
clearer: I avoided creating a tmpctx in a few places because I didn't
want to add another allocation.  With that penalty removed, I can use
it more freely and hopefully write clearer code.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
Rusty Russell
41ef42ee94 memdump: fix overzealous assertions from b857b2e843
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2018-03-16 00:16:10 +00:00
ZmnSCPxj
f9bc0353c4 devtools/onion: Add to gitignore. 2018-03-14 18:31:45 +01:00
ZmnSCPxj
ed3984f444 test_lightningd.py: Modify test_payment_duplicate_uncommitted.
`pay` command will now wait for payment to succeed if the
payment has been initiated.
2018-03-14 05:33:09 +00:00
ZmnSCPxj
a0c2686ebd pay: Have sendpay wait for payment to be saved.
The payment should be stored in a "timely" manner, i.e.
within 10ms.
2018-03-14 05:33:09 +00:00
ZmnSCPxj
a7a18b96cf pay: Rename some sendpay functions and fields to waitsendpay
Nearer to their actual purposes at this point.  Also in preparation
for next change.
2018-03-14 05:33:09 +00:00
ZmnSCPxj
61882ed9df pay: Add hook for triggering storage of payments. 2018-03-14 05:33:09 +00:00
ZmnSCPxj
24ee5d0437 pay: Store payment on failure. 2018-03-14 05:33:09 +00:00
ZmnSCPxj
60f5abdc9b wallet: Make wallet_payment_store idempotent. 2018-03-14 05:33:09 +00:00
ZmnSCPxj
8fd71ad654 doc: Update sendpay and waitsendpay manpages. 2018-03-14 05:33:09 +00:00
ZmnSCPxj
411c9583a7 pay: Save and recover failure information.
Needed for particular race condition: client calls `sendpay` with
intent to call `waitsendpay` later to get information, but the
payment fails after `sendpay` returns but before client can invoke
`waitsendpay`.
This lets client know of information even if it manages to invoke
`waitsendpay` "late".
2018-03-14 05:33:09 +00:00
ZmnSCPxj
693c718160 wallet: Add DB fields for recording routing failures. 2018-03-14 05:33:09 +00:00
ZmnSCPxj
752b7f5277 test_lightningd.py: Update for nonblocking sendpay. 2018-03-14 05:33:09 +00:00