Skip to content

fwdinghistory doesn't include HTLCs settled using HTLC interceptor RPC #4910

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
champo opened this issue Jan 11, 2021 · 5 comments
Open

fwdinghistory doesn't include HTLCs settled using HTLC interceptor RPC #4910

champo opened this issue Jan 11, 2021 · 5 comments
Labels
accounting bug Unintended code behaviour htlcswitch P4 low prio

Comments

@champo
Copy link
Contributor

champo commented Jan 11, 2021

Background

At Muun we're using the HTLC interceptor RPC to settle HTLCs for our implementation of reverse swaps. I'm trying to determine whether the HTLC was properly claimed after the RPC call, but the fwdinghistory CLI command doesn't seem to include these HTLCs. In my tests, the HTLC seems to have been claimed by lnd since the sender received the preimage and the channel balances changed, but there seems to be no other record of this operation.

Your environment

  • version of lnd: 0.11.0-beta
  • which operating system: Linux lnd-03-mainnet-0 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64 Linux
  • bitcoind: 0.19.0

Expected behaviour

See the HTLCs in the fwdinghistory for accounting purpouses.

Actual behaviour

They don't show up.

@champo
Copy link
Contributor Author

champo commented Jan 11, 2021

I also see no mention of the preimageBeacon logs that indicate the preimage has been recorded, which seems weird.

@Roasbeef
Copy link
Member

In my tests, the HTLC seems to have been claimed by lnd

If they were claimed by the lnd node under your control, then this isn't actually a forward. As a result, it won't come across as a forward since your node is the terminal node (you received the payment).

@champo
Copy link
Contributor Author

champo commented Jan 15, 2021

They are a forward since the next step of the route was claimed by another node (just not a full BOLT compliant node). But rather than argue semantics, what I'd like is to understand where this claim is reflected and how to access it for accounting purpouses. The HTLC intercept API has no feedback on whether the SETTLE command was successful and we could simply be loosing funds and we have no way to find out AFAICT.

@Roasbeef
Copy link
Member

It isn't a question of semantics given both the outgoing edge wasn't fully specified in the onion itself, as your system resolves it manually. A forward as defined within lnd is something that enters and exits lnd via the existing automated process, you've added an entirely new flow. Therefore the class of transactions you're referring to won't show up in ForwardingHistory at the outgoing edge is essentially "unknown".

As a result, you'll need to externally account for this "special" case as lnd doesn't understand (nor does it need to really) what you're doing at a higher level.

If you want to track this progress externally, you can use the ScubrscribeHtlcEvents call on the router-rpc sub-server. You'll be able to view all HTLC progress from the PoV of the link (the channel) rather than the switch.

@champo
Copy link
Contributor Author

champo commented Jan 19, 2021

the outgoing edge wasn't fully specified in the onion itself

I think you have a misconception here. In our impl the outgoing edge is specified in the onion, LND is not the last hop of the onion but rather the previous one. We are simply implementing the outgoing link via HTTP. All the data ForwardingHistory needs is present, which is why I expected to find those HTLCs there.

As a result, you'll need to externally account for this "special" case as lnd doesn't understand (nor does it need to really) what you're doing at a higher level.

I dont understand this rationale. As I see it money gets shuffled around by the node and that should be recorded somewhere. It might be "special", but it still is a transaction executed by LND.

ScubrscribeHtlcEvents

Perfect! We can make do with that.

@Roasbeef Roasbeef added this to the v0.15.0 milestone Nov 17, 2021
@Roasbeef Roasbeef added accounting bug Unintended code behaviour htlcswitch labels Nov 17, 2021
@Roasbeef Roasbeef modified the milestones: v0.15.0, v0.16.0 Mar 7, 2022
@Roasbeef Roasbeef modified the milestones: v0.16.0, Future Aug 23, 2022
@saubyk saubyk modified the milestones: Future, Low Priority Aug 4, 2023
@saubyk saubyk added the P3 might get fixed, nice to have label Aug 8, 2023
@saubyk saubyk removed this from the Low Priority milestone Aug 8, 2023
@saubyk saubyk added P4 low prio and removed P3 might get fixed, nice to have labels Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accounting bug Unintended code behaviour htlcswitch P4 low prio
Projects
None yet
Development

No branches or pull requests

3 participants