mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
lightningd: handle case where channeld fails locally-generated HTLC.
jl777 reported a crash when we try to pay past reserve. Fix that (and a whole class of related bugs) and add tests. In test_lightning.py I had to make non-async path for sendpay() non-threaded to get the exception passed through for testing. Closes: #236 Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
52db7fd27b
commit
1cf33eefe2
@@ -413,7 +413,14 @@ static bool rcvd_htlc_reply(struct subd *subd, const u8 *msg, const int *fds,
|
||||
}
|
||||
|
||||
if (failure_code) {
|
||||
local_fail_htlc(hout->in, failure_code);
|
||||
if (!hout->in) {
|
||||
char *localfail = tal_fmt(msg, "%s: %.*s",
|
||||
onion_type_name(failure_code),
|
||||
(int)tal_len(failurestr),
|
||||
(const char *)failurestr);
|
||||
payment_failed(hout->key.peer->ld, hout, localfail);
|
||||
} else
|
||||
local_fail_htlc(hout->in, failure_code);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user