mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-01 17:47:30 +01:00
lightningd: handle fail_htlc_in with no known outgoing channel.
Turn it into temporary node failure: this only happens if we restart with a failed htlc in, but it's clearer and more robust to handle it generically. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
bb9b761dda
commit
c7bbdd76d3
2 changed files with 11 additions and 9 deletions
|
@ -109,8 +109,16 @@ static void fail_in_htlc(struct htlc_in *hin,
|
|||
hin->failonion = dup_onionreply(hin, failonion);
|
||||
|
||||
/* We need this set, since we send it to channeld. */
|
||||
if (hin->failcode & UPDATE)
|
||||
if (hin->failcode & UPDATE) {
|
||||
/* We don't save the outgoing channel which failed; probably
|
||||
* not worth it for this corner case. So we can't set
|
||||
* hin->failoutchannel to tell channeld what update to send,
|
||||
* thus we turn those into a WIRE_TEMPORARY_NODE_FAILURE. */
|
||||
if (!out_channelid)
|
||||
hin->failcode = WIRE_TEMPORARY_NODE_FAILURE;
|
||||
else
|
||||
hin->failoutchannel = *out_channelid;
|
||||
}
|
||||
|
||||
/* We update state now to signal it's in progress, for persistence. */
|
||||
htlc_in_update_state(hin->key.channel, hin, SENT_REMOVE_HTLC);
|
||||
|
@ -2167,6 +2175,7 @@ static const struct json_command dev_ignore_htlcs = {
|
|||
"Set ignoring incoming HTLCs for peer {id} to {ignore}", false,
|
||||
"Set/unset ignoring of all incoming HTLCs. For testing only."
|
||||
};
|
||||
|
||||
AUTODATA(json_command, &dev_ignore_htlcs);
|
||||
#endif /* DEVELOPER */
|
||||
|
||||
|
|
|
@ -1904,13 +1904,6 @@ static bool wallet_stmt2htlc_out(struct wallet *wallet,
|
|||
|
||||
static void fixup_hin(struct wallet *wallet, struct htlc_in *hin)
|
||||
{
|
||||
/* We don't save the outgoing channel which failed; probably not worth
|
||||
* it for this corner case. So we can't set hin->failoutchannel to
|
||||
* tell channeld what update to send, thus we turn those into a
|
||||
* WIRE_TEMPORARY_NODE_FAILURE. */
|
||||
if (hin->failcode & UPDATE)
|
||||
hin->failcode = WIRE_TEMPORARY_NODE_FAILURE;
|
||||
|
||||
/* We didn't used to save failcore, failonion... */
|
||||
#ifdef COMPAT_V061
|
||||
/* We care about HTLCs being removed only, not those being added. */
|
||||
|
|
Loading…
Add table
Reference in a new issue