mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
wallet: allow saving forwarding scid even if we don't have amount.
They're not logically connected: we can know where they wanted to go, but we didn't send it. Where possible, it's the scid *they asked for*; otherwise, it's the scid or fallback to the alias, but do this in the *caller*, not by overriding inside wallet_forwarded_payment_add. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -702,7 +702,7 @@ static void forward_htlc(struct htlc_in *hin,
|
||||
local_fail_in_htlc(hin, take(towire_unknown_next_peer(NULL)));
|
||||
wallet_forwarded_payment_add(hin->key.channel->peer->ld->wallet,
|
||||
hin, get_onion_style(hin),
|
||||
next ? next->scid : NULL, NULL,
|
||||
scid, NULL,
|
||||
FORWARD_LOCAL_FAILED,
|
||||
WIRE_UNKNOWN_NEXT_PEER);
|
||||
return;
|
||||
@@ -797,7 +797,7 @@ static void forward_htlc(struct htlc_in *hin,
|
||||
fail:
|
||||
local_fail_in_htlc(hin, failmsg);
|
||||
wallet_forwarded_payment_add(ld->wallet,
|
||||
hin, get_onion_style(hin), next->scid, hout,
|
||||
hin, get_onion_style(hin), scid, hout,
|
||||
FORWARD_LOCAL_FAILED,
|
||||
fromwire_peektype(failmsg));
|
||||
}
|
||||
@@ -1337,7 +1337,7 @@ static void fulfill_our_htlc_out(struct channel *channel, struct htlc_out *hout,
|
||||
fulfill_htlc(hout->in, preimage);
|
||||
wallet_forwarded_payment_add(ld->wallet, hout->in,
|
||||
get_onion_style(hout->in),
|
||||
hout->key.channel->scid, hout,
|
||||
channel_scid_or_local_alias(hout->key.channel), hout,
|
||||
FORWARD_SETTLED, 0);
|
||||
}
|
||||
}
|
||||
@@ -1465,7 +1465,7 @@ static bool peer_failed_our_htlc(struct channel *channel,
|
||||
if (hout->in)
|
||||
wallet_forwarded_payment_add(ld->wallet, hout->in,
|
||||
get_onion_style(hout->in),
|
||||
channel->scid,
|
||||
channel_scid_or_local_alias(channel),
|
||||
hout, FORWARD_FAILED,
|
||||
hout->failmsg
|
||||
? fromwire_peektype(hout->failmsg)
|
||||
@@ -1628,7 +1628,7 @@ void onchain_failed_our_htlc(const struct channel *channel,
|
||||
take(towire_permanent_channel_failure(NULL)));
|
||||
wallet_forwarded_payment_add(hout->key.channel->peer->ld->wallet,
|
||||
hout->in, get_onion_style(hout->in),
|
||||
channel->scid, hout,
|
||||
channel_scid_or_local_alias(channel), hout,
|
||||
FORWARD_LOCAL_FAILED,
|
||||
hout->failmsg
|
||||
? fromwire_peektype(hout->failmsg)
|
||||
@@ -1795,7 +1795,7 @@ static bool update_out_htlc(struct channel *channel,
|
||||
if (hout->in) {
|
||||
wallet_forwarded_payment_add(ld->wallet, hout->in,
|
||||
get_onion_style(hout->in),
|
||||
channel->scid, hout,
|
||||
channel_scid_or_local_alias(channel), hout,
|
||||
FORWARD_OFFERED, 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user