Skip to content
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

[bug]: cannot connect to peer - "failing link: unable to handle upstream settle with error: invalid update", "unknown channel ID" #8130

Closed
xmrk-btc opened this issue Oct 30, 2023 · 15 comments
Labels
bug Unintended code behaviour htlcswitch needs triage P1 MUST be fixed or reviewed

Comments

@xmrk-btc
Copy link

Background

I had a channel, but could not connect to the peer, always getting disconnected with logs like this:

2023-10-29 07:05:42.433 [INF] PEER: Peer(031c8b9e52039af6892015702bab9b7e13b46979a519497ad8b6674bfe88ea7c27): Loading ChannelPo
int(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1), isPending=false
2023-10-29 07:05:42.434 [INF] HSWC: ChannelLink(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1): starting
2023-10-29 07:05:42.434 [INF] HSWC: Trimming open circuits for chan_id=812226:2620:1, start_htlc_id=18712
2023-10-29 07:05:42.434 [INF] HSWC: Adding live link chan_id=057db5b8d01f29a2cf2be64561dab3eacce6d8312de000c88862b7bae1e86ae0, 
short_chan_id=812226:2620:1
2023-10-29 07:05:42.434 [INF] HSWC: ChannelLink(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1): HTLC manag
er started, bandwidth=2316950 mSAT
2023-10-29 07:05:42.434 [INF] HSWC: ChannelLink(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1): attempting
 to re-synchronize
2023-10-29 07:05:42.434 [INF] PEER: Peer(031c8b9e52039af6892015702bab9b7e13b46979a519497ad8b6674bfe88ea7c27): Negotiated chan s
eries queries
2023-10-29 07:05:42.434 [INF] DISC: Creating new GossipSyncer for peer=031c8b9e52039af6892015702bab9b7e13b46979a519497ad8b6674b
fe88ea7c27
2023-10-29 07:05:42.434 [INF] NTFN: New block epoch subscription
2023-10-29 07:05:42.434 [INF] CNCT: Attempting to update ContractSignals for ChannelPoint(e16ae8e1bab76288c800e02d31d8e6cceab3d
a6145e62bcfa2291fd0b8b57d05:1)
2023-10-29 07:05:42.705 [INF] HSWC: ChannelLink(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1): received r
e-establishment message from remote side
2023-10-29 07:05:42.713 [ERR] HSWC: ChannelLink(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1): failing li
nk: unable to handle upstream settle with error: invalid update
2023-10-29 07:05:42.713 [ERR] HSWC: ChannelLink(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1): link faile
d, exiting htlcManager
2023-10-29 07:05:42.713 [INF] HSWC: ChannelLink(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1): exited
2023-10-29 07:05:42.713 [INF] HSWC: ChannelLink(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1): stopping
2023-10-29 07:05:42.713 [INF] HSWC: Removing channel link with ChannelID(057db5b8d01f29a2cf2be64561dab3eacce6d8312de000c88862b7bae1e86ae0)
2023-10-29 07:05:42.726 [ERR] PEER: Peer(031c8b9e52039af6892015702bab9b7e13b46979a519497ad8b6674bfe88ea7c27): Unknown channel ID: 057db5b8d01f29a2cf2be64561dab3eacce6d8312de000c88862b7bae1e86ae0 found in received msg=UpdateAddHTLC
2023-10-29 07:05:42.726 [ERR] PEER: Peer(031c8b9e52039af6892015702bab9b7e13b46979a519497ad8b6674bfe88ea7c27): Unknown channel ID: 057db5b8d01f29a2cf2be64561dab3eacce6d8312de000c88862b7bae1e86ae0 found in received msg=CommitSig
2023-10-29 07:05:42.726 [ERR] PEER: Peer(031c8b9e52039af6892015702bab9b7e13b46979a519497ad8b6674bfe88ea7c27): Unknown channel ID: 057db5b8d01f29a2cf2be64561dab3eacce6d8312de000c88862b7bae1e86ae0 found in received msg=RevokeAndAck

The channel has been force-closed a day later, to claim the incoming HTLC I guess. The channel was working and forwarding at least until 28/Oct/2023 22:54 (the last recorded forward according to my node). I have / had 3-4 other channels with the same problem, at least in one case the complaints about unknown channel ID stopped, without restarting lnd and without closing that channel.

At the very least, this problem makes a channel unusable. And sounds a bit scary, did one of the nodes lose some data? How can a node suddenly stop recognizing its channel?

Your environment

  • version of lnd: 0.17 (both peers). I use boltdb, peer probably postgres (on raspiblitz).
  • which operating system: Debian 12.1
  • version of bitcoind: v25.1rc1

Steps to reproduce

No idea.

Expected behaviour

Should be able to connect.

@xmrk-btc xmrk-btc added bug Unintended code behaviour needs triage labels Oct 30, 2023
@bitromortac
Copy link
Collaborator

Could you look up the hash of the HTLC and grep for logs? It seems that your node force closed, could you verify that?

@xmrk-btc
Copy link
Author

Could you look up the hash of the HTLC and grep for logs? It seems that your node force closed, could you verify that?

No, according to my logs the peer closed:

2023-10-30 21:09:34.630 [INF] NTFN: New block: height=814568, sha=0000000000000000000179adcc9d73d93126623f3c12a77e47244725868d9
399
2023-10-30 21:09:34.631 [INF] NTFN: Dispatching confirmed spend notification for outpoint=e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1, script=0 e25d26d0f38c5bf0b0dbc9ffd98347b50032410ca5d4a2783a6b5fb7c101ac85 at current height=814568: 8ed69f86be442d45d196943c2650e0f4c7e4a542b580224cc8ef12829c758f2b[0] spending e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1 at height=814568
2023-10-30 21:09:34.632 [INF] CNCT: Remote party broadcast pending set, commit_num=96435
2023-10-30 21:09:34.632 [INF] CNCT: Unilateral close of ChannelPoint(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1) detected
2023-10-30 21:09:34.633 [INF] CNCT: ChannelArbitrator(e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1): remote party has closed channel out on-chain

Shortly after this, regarding the HTLC:

2023-10-30 21:09:34.769 [INF] HSWC: Received outside contract resolution, mapping to: (*htlcswitch.htlcPacket)(0xc029f69ef0)({
 incomingChanID: (lnwire.ShortChannelID) 0:0:0,
 outgoingChanID: (lnwire.ShortChannelID) 812226:2620:1,
 incomingHTLCID: (uint64) 0,
 outgoingHTLCID: (uint64) 18711,
 sourceRef: (*channeldb.AddRef)(<nil>),
 destRef: (*channeldb.SettleFailRef)(<nil>),
 incomingAmount: (lnwire.MilliSatoshi) 0 mSAT,
 amount: (lnwire.MilliSatoshi) 0 mSAT,
 htlc: (*lnwire.UpdateFailHTLC)(0xc03c444d20)({
  ChanID: (lnwire.ChannelID) (len=32 cap=32) 0000000000000000000000000000000000000000000000000000000000000000,
  ID: (uint64) 0,
  Reason: (lnwire.OpaqueReason) <nil>,
  ExtraData: (lnwire.ExtraOpaqueData) <nil>
 }),
 obfuscator: (hop.ErrorEncrypter) <nil>,
 localFailure: (bool) false,
 linkFailure: (*htlcswitch.LinkError)(<nil>),
 convertedError: (bool) false,
 hasSource: (bool) false,
 isResolution: (bool) true,
 circuit: (*htlcswitch.PaymentCircuit)(<nil>),
 incomingTimeout: (uint32) 0,
 outgoingTimeout: (uint32) 0,
 customRecords: (record.CustomSet) <nil>,
 originalOutgoingChanID: (lnwire.ShortChannelID) 0:0:0
})

The channel is still in pendingchannels (not closedchannels), the htlc is:

            "pending_htlcs": [
                {
                    "incoming": true,
                    "amount": "34159",
                    "outpoint": "8ed69f86be442d45d196943c2650e0f4c7e4a542b580224cc8ef12829c758f2b:3",
                    "maturity_height": 814775,
                    "blocks_til_maturity": 68,
                    "stage": 1
                }
            ],

@bitromortac
Copy link
Collaborator

Are you in contact with the peer? If so it would be helpful if they could share logs (can do that privately, dm on slack perhaps).

@ziggie1984
Copy link
Collaborator

ziggie1984 commented Nov 5, 2023

Maybe we should add a log here:https://github.com/lightningnetwork/lnd/blob/master/htlcswitch/link.go#L1752. Because I am curious what HTLC did you Peer try to settle with you.
Apart from that, I am a bit confused can you please let me know @xmrk-btc which output belonged to your after the force-close (not the htlc but the other). Normally when your peer force-closed it should be this one:https://mempool.space/tx/d1fb33a0d629e5d2cd3eb7e55ba6ea4e41d73ad4c42f486d5a37be5de5a26591. Because what confuses me although your peer force-closed according to your logs the htlc which got resolved onchain could only belong to the person who was the owner of the force-close (because it got swept with the second-level timeout covenant). So it is important to know which of the other outputs of the FC belonged to you.

@xmrk-btc
Copy link
Author

Maybe we should add a log here:https://github.com/lightningnetwork/lnd/blob/master/htlcswitch/link.go#L1752. Because I am curious what HTLC did you Peer try to settle with you. Apart from that, I am a bit confused can you please let me know @xmrk-btc which output belonged to your after the force-close (not the htlc but the other). Normally when your peer force-closed it should be this one:https://mempool.space/tx/d1fb33a0d629e5d2cd3eb7e55ba6ea4e41d73ad4c42f486d5a37be5de5a26591. Because what confuses me although your peer force-closed according to your logs the htlc which got resolved onchain could only belong to the person who was the owner of the force-close (because it got swept with the second-level timeout covenant). So it is important to know which of the other outputs of the FC belonged to you.

I think it is d1fb33 tx you mention, this is the full lncli closedchannels info for that channel:

        {
            "channel_point": "e16ae8e1bab76288c800e02d31d8e6cceab3da6145e62bcfa2291fd0b8b57d05:1",
            "chan_id": "893051931553693697",
            "chain_hash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
            "closing_tx_hash": "8ed69f86be442d45d196943c2650e0f4c7e4a542b580224cc8ef12829c758f2b",
            "remote_pubkey": "031c8b9e52039af6892015702bab9b7e13b46979a519497ad8b6674bfe88ea7c27",
            "capacity": "3000000",
            "close_height": 814568,
            "settled_balance": "32316",
            "time_locked_balance": "0",
            "close_type": "REMOTE_FORCE_CLOSE",
            "open_initiator": "INITIATOR_REMOTE",
            "close_initiator": "INITIATOR_REMOTE",
            "resolutions": [
                {
                    "resolution_type": "COMMIT",
                    "outcome": "CLAIMED",
                    "outpoint": {
                        "txid_bytes": "2b8f759c8212efc84c2280b542a5e4c7f4e050263c9496d1452d44be869fd68e",
                        "txid_str": "8ed69f86be442d45d196943c2650e0f4c7e4a542b580224cc8ef12829c758f2b",
                        "output_index": 2
                    },
                    "amount_sat": "32316",
                    "sweep_txid": "d1fb33a0d629e5d2cd3eb7e55ba6ea4e41d73ad4c42f486d5a37be5de5a26591"
                },
                {
                    "resolution_type": "INCOMING_HTLC",
                    "outcome": "TIMEOUT",
                    "outpoint": {
                        "txid_bytes": "2b8f759c8212efc84c2280b542a5e4c7f4e050263c9496d1452d44be869fd68e",
                        "txid_str": "8ed69f86be442d45d196943c2650e0f4c7e4a542b580224cc8ef12829c758f2b",
                        "output_index": 3
                    },
                    "amount_sat": "34159",
                    "sweep_txid": ""
                }
            ],
            "alias_scids": [],
            "zero_conf_confirmed_scid": "0"
        },

@xmrk-btc
Copy link
Author

Are you in contact with the peer? If so it would be helpful if they could share logs (can do that privately, dm on slack perhaps).

Sorry for horribly late reply, the original peer told he had logs for past 30 minutes, so I assumed he did not have anything when you asked.

But as mentioned, had the same problem with other peers, contacted one of them - KnockOnWood / 039e05e271f537cfa1c060d2364b960b85bd509ac89bae524e4a01948a07b3e8d1 . In this case the outage only lasted for 15 minutes. From my side:

2023-10-30 09:15:08.315 [ERR] PEER: Peer(039e05e271f537cfa1c060d2364b960b85bd509ac89bae524e4a01948a07b3e8d1): Unknown channel ID: fa17a30abdba5fde99d1f8a53dd7dabd40f95ff0b05e9472c354a53eb762fa2b found in received msg=UpdateFailHTLC
2023-10-30 09:30:24.629 [ERR] PEER: Peer(039e05e271f537cfa1c060d2364b960b85bd509ac89bae524e4a01948a07b3e8d1): Unknown channel ID: fa17a30abdba5fde99d1f8a53dd7dabd40f95ff0b05e9472c354a53eb762fa2b found in received msg=UpdateAddHTLC
...
2023-10-30 09:31:28.182 [INF] HSWC: Adding live link chan_id=fa17a30abdba5fde99d1f8a53dd7dabd40f95ff0b05e9472c354a53eb762fa2b, short_chan_id=802214:510:0

They wrote:

at that time, :15 and even :14, there are no hits for your pubkey, while searching for funding txid I got these, both at :15 and at :14

[WRN] HSWC: ChannelLink(2bfa62b73ea554c372945eb0f05ff940bddad73da5f8d199de5fbabd0aa317fa:0): outgoing htlc(130000e748d4288914dab97588bbb0ef661d4b5fe485fd39d444b68902ad26a0) has insufficient fee: expected 633, got 356
[WRN] HSWC: ChannelLink(2bfa62b73ea554c372945eb0f05ff940bddad73da5f8d199de5fbabd0aa317fa:0): outgoing htlc(ab4dbd9e498e91a02e8b13db1ae64b0fe125e9cd862d0b32038a58ce1ba2ce42) has insufficient fee: expected 729, got 409
[WRN] HSWC: ChannelLink(2bfa62b73ea554c372945eb0f05ff940bddad73da5f8d199de5fbabd0aa317fa:0): outgoing htlc(03576574dcd8df691e90c0ff9dc875ec94f96459ac04f9e3ab00b539c22981a0) has insufficient fee: expected 369, got 209
[WRN] HSWC: ChannelLink(2bfa62b73ea554c372945eb0f05ff940bddad73da5f8d199de5fbabd0aa317fa:0): outgoing htlc(759b62a683b109ae3a1e906741448878631a35eb7c1565d0e298cc7b6daf31e4) has insufficient fee: expected 99, got 69

Sounded very strange, I thought my node did try to contact theirs, so would expect my node mentioned, but we have at least some info .

@ziggie1984
Copy link
Collaborator

ziggie1984 commented Nov 11, 2023

I think it is d1fb33 tx you mention, this is the full lncli closedchannels info for that channel:

Ok that brings a bit light into this problem, so the HTLC which you have in your closedchannels output was not yours and was claimed by your peer. Main question which needs to be answered: Which HTLC was your Peer trying to Settle with you when there were no outgoing HTLCs from your side (you can only settle outgoing HTLCs and the peer had non on the commitment). So very interesting case but without the logs of your peer this will be difficult to debug.

[WRN] HSWC: ChannelLink(2bfa62b73ea554c372945eb0f05ff940bddad73da5f8d199de5fbabd0aa317fa:0): outgoing htlc(759b62a683b109ae3a1e906741448878631a35eb7c1565d0e298cc7b6daf31e4) has insufficient fee: expected 99, got 69

These messages are normal, which basically means the sender of the payment had an old Policy update of your channel and you are rejecting this htlc.

@ziggie1984
Copy link
Collaborator

ziggie1984 commented Nov 22, 2023

So encountered the exact same problem with another node and I could narrow down the problem. So in case you still have some channels which do not reactive because of a invalid update you could follow the steps laid down below to confirm that the situation is the same for you.

@Roasbeef @yyforyongyu I think you should take a look at this.

What happened to the other noderunner:

He had a channel with 10 htlcs with the following relevant forwarded HTLC:

           {
                "incoming": false,
                "amount": "67047",
                "hash_lock": "5cf6c63902a114e34dcbda08c5c9ad2718c9f172c36d069fc90b80702e0588f4",
                "expiration_height": 818265,
                "htlc_index": "103214",
                "forwarding_channel": "XXXX",
                "forwarding_htlc_index": "XXXXXXX"
            },

Now his peer also an LND node tried to settle this exact HTLC with an UpdateFulfillHTLC msg. So far so good now comes the problem:

He tries to settle the HTLC with the ID:

Received UpdateFulfillHTLC(chan_id=cb6f9d6b9e525f4f393ad0829ffa2696cc244d8b7fd55d3d6bd2d6c1ff31ad3e, id=103214, pre_image=5183dbc0d4da7160aeeb43c19d20910139e18b8468f64c6feb69d1beac67f812) from ....

But somehow his node thinks this HTLC is not locked in:

2023-11-22 10:13:06.966 [ERR] HSWC: ChannelLink(3fad31ffc1d6d26b3d5dd57f8b4d24cc9626fa9f82d03a394f5f529e6b9d6fcb:1): failing link: unable to handle upstream settle with error: invalid update

=> relevant codeline:

"unable to handle upstream settle",

What I think happens is that somehow the hashes of the 2 onionblobs remote and local differ and therefore we do not count this HTLC as an active HTLC which is fully locked in.

=> relevant codeline: https://github.com/lightningnetwork/lnd/blob/master/channeldb/channel.go#L2094-L2120

Looking shortly at this code, I am not sure whether we need this kind of strict check, do we really need to make sure both onion-blobs are the same in the Settle-Case, I mean we can just try whether the preimage is good and if it is we will never need this Onion-Blob anyways.... So I think this check can be loosened up, remains the question how could the two onion-blobs diverge, maybe we need to check in detail whether we do not flush different things in some cases.

Apart from that the related Channel got Force-Closed and the relevant HTLC got swept by the preimage by its peer which is evidence that the peer tried to settle the correct HTLC and the problem lies indeed locally in having a database inconsistency between the remote and the local onionblob.

Sweep of the HTLC by the preimage:

https://mempool.space/tx/9a98fcd342d575dbbd225a8d921b605664eed3b90c6306a4723b56521293f02d

@yyforyongyu
Copy link
Member

Could you guys patch #8220 so we can have more info around this area? Thanks!

@ziggie1984
Copy link
Collaborator

ziggie1984 commented Nov 22, 2023

In case your relevant channel is already closed, use lightninglabs/chantools#97 to dump the relevant data to the terminal.

chantools dumphistoricalchannel --channeldb ./channel.db --chan_point XXXXXX:Y

@ziggie1984
Copy link
Collaborator

We were able to get the relevant data at least for the case I mentioned and it underlines my assumption that the sha onions mismatch. But it's weird because only one single HTLC matches in the onionblob sha of remote and local:

2023-11-23 08:56:09.941 [DBG] CHAN: ===========================================================
2023-11-23 08:56:09.941 [DBG] CHAN: RemoteCommitment: height=237864
2023-11-23 08:56:09.941 [DBG] CHAN: LocalCommitment: height=237901
2023-11-23 08:56:09.941 [DBG] CHAN: RemoteCommitment has htlc: id=103208, update=121227 incoming=false
2023-11-23 08:56:09.941 [DBG] CHAN: RemoteCommitment has htlc: id=103212, update=121231 incoming=false
2023-11-23 08:56:09.941 [DBG] CHAN: RemoteCommitment has htlc: id=103213, update=121232 incoming=false
2023-11-23 08:56:09.941 [DBG] CHAN: RemoteCommitment has htlc: id=103214, update=121233 incoming=false
2023-11-23 08:56:09.941 [DBG] CHAN: RemoteCommitment has htlc: id=103216, update=121235 incoming=false
2023-11-23 08:56:09.941 [DBG] CHAN: RemoteCommitment has htlc: id=103217, update=121236 incoming=false
2023-11-23 08:56:09.941 [DBG] CHAN: RemoteCommitment has htlc: id=103218, update=121237 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: RemoteCommitment has htlc: id=103219, update=121239 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: RemoteCommitment has htlc: id=103220, update=121240 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: RemoteCommitment has htlc: id=103221, update=121241 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103208, update=121227 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Skipped htlc due to onion has not matched: id=103208, update=121227 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103212, update=121231 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Skipped htlc due to onion has not matched: id=103212, update=121231 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103213, update=121232 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Skipped htlc due to onion has not matched: id=103213, update=121232 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103214, update=121233 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Skipped htlc due to onion has not matched: id=103214, update=121233 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103216, update=121235 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Skipped htlc due to onion has not matched: id=103216, update=121235 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103217, update=121236 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Skipped htlc due to onion has not matched: id=103217, update=121236 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103218, update=121237 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Skipped htlc due to onion has not matched: id=103218, update=121237 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103219, update=121239 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Skipped htlc due to onion has not matched: id=103219, update=121239 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103220, update=121240 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Skipped htlc due to onion has not matched: id=103220, update=121240 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: LocalCommitment has htlc: id=103221, update=121241 incoming=false
2023-11-23 08:56:09.942 [DBG] CHAN: Active htlcs on the local commitment when the channel closed
([]channeldb.HTLC) (len=1 cap=1) {
 (channeldb.HTLC) {
  Signature: ([]uint8) (len=71 cap=71) {
   00000000  30 45 02 21 00 ef 23 db  b0 ba 55 bf c2 ae 52 53  |0E.!..#...U...RS|
   00000010  dc cb cf 42 ca 1b 70 9f  02 7c cc 86 ca 3c 8b 08  |...B..p..|...<..|
   00000020  d0 5d 26 07 41 02 20 52  9b a7 3f 7e 17 9e a6 ac  |.]&.A. R..?~....|
   00000030  62 e7 21 4a b6 95 0b 2f  9b 42 08 73 5d 8b 9e 98  |b.!J.../.B.s]...|
   00000040  4b 6f 10 e1 6e 4a 14                              |Ko..nJ.|
  },
  RHash: ([32]uint8) (len=32 cap=32) {
   00000000  aa 76 72 03 51 f8 a6 a2  c1 8d 5f 04 75 13 03 1b  |.vr.Q....._.u...|
   00000010  a4 b3 e4 e7 8b 0d 9e 2d  d6 22 93 cd ad 40 61 1b  |.......-."...@a.|
  },
  Amt: (lnwire.MilliSatoshi) 172017267 mSAT,
  RefundTimeout: (uint32) 818044,
  OutputIndex: (int32) 11,
  Incoming: (bool) false,
  OnionBlob: ([1366]uint8) (len=1366 cap=1366) {
   00000000  00 03 f0 80 da fd 17 36  be fe aa 9c 31 3a ff a9  |.......6....1:..|
   00000010  f8 7c 06 0c 45 bf ed 44  6b f5 59 d8 31 da b1 f4  |.|..E..Dk.Y.1...|
   00000020  5b eb da 45 d0 fe 0d ec  7e 1f b9 07 ef 87 fb a6  |[..E....~.......|
   00000030  4a 16 1c 5d 02 3a a8 a6  7e f9 57 eb 23 69 b7 37  |J..].:..~.W.#i.7|
   00000040  62 b2 f1 99 df e9 7f 1e  29 7b 02 4d b0 ae 7e aa  |b.......){.M..~.|
   00000050  56 17 b4 9e 55 a9 b9 a6  e7 dd 85 a0 b0 d0 dd a6  |V...U...........|
   00000060  65 13 0b 0d 4b 3c 79 1b  63 b1 e7 57 8a 35 57 03  |e...K<y.c..W.5W.|
   00000070  15 33 c9 1f 55 24 a7 2d  4d ba 1a d1 f0 1b ae 1a  |.3..U$.-M.......|
   00000080  c3 09 f9 cd 64 2c 6b 9c  0a 0e b6 19 0e e1 40 36  |....d,k.......@6|
   00000090  5b c3 72 7b 3e 6f 79 3a  90 9e 40 1e 04 e5 13 28  |[.r{>oy:..@....(|
   000000a0  6a f1 1e 1c a2 fc f0 16  1d b9 0b b4 7b 9d 7a 77  |j...........{.zw|
   000000b0  6f f7 3f 19 d6 8a 95 56  b7 48 97 c6 82 0e f8 c7  |o.?....V.H......|
   000000c0  02 fe 9b ad a1 ad c4 68  36 0b cc a2 e5 41 69 16  |.......h6....Ai.|
   000000d0  71 a1 7e d8 f9 76 60 97  d8 85 72 32 d7 7e 5d dc  |q.~..v`...r2.~].|
   000000e0  14 fc 98 ac 8b e8 18 97  ef 41 40 14 4f 85 08 4b  |[email protected]|
   000000f0  03 52 24 30 c8 09 49 43  52 52 8a bb e8 1f fc bb  |.R$0..ICRR......|
   00000100  b9 8a a9 05 db 31 62 93  4f e5 24 91 7c 0f 92 d9  |.....1b.O.$.|...|
   00000110  e8 37 1a 9e 0b 68 e7 a8  16 09 c8 2e 4a b9 c3 aa  |.7...h......J...|
   00000120  18 ac c2 6d 2d 24 4d 50  ee 57 54 12 b5 65 34 04  |...m-$MP.WT..e4.|
   00000130  97 9d dc a8 2b 2b 89 de  81 88 1b 06 1d 3e 28 6b  |....++.......>(k|
   00000140  ef e2 3a 13 5d e6 36 f0  ec a2 ae 84 a5 41 ca e3  |..:.].6......A..|
   00000150  c9 b6 84 93 1f 6c 21 51  62 d3 d5 ac ba cf 3a e7  |.....l!Qb.....:.|
   00000160  2d 39 26 4f 51 1e 44 1a  7a 1f 5b b7 66 8e f7 99  |-9&OQ.D.z.[.f...|
   00000170  72 cd 6f c9 08 89 91 b6  60 55 0d 6a af 55 1c 7d  |r.o.....`U.j.U.}|
   00000180  4d cb 67 f3 35 82 fa 14  b3 dc bf a1 6a d5 71 a0  |M.g.5.......j.q.|
   00000190  b3 2e 79 a0 e1 a6 fb 23  8b e5 f3 d2 6c 85 d1 a9  |..y....#....l...|
   000001a0  0a 7c a5 c5 0b 16 af 7d  87 76 16 79 34 8e 05 3e  |.|.....}.v.y4..>|
   000001b0  1a 0a d3 df c0 04 e0 75  3f 4f 73 38 61 ca 46 d4  |.......u?Os8a.F.|
   000001c0  02 e5 73 43 f9 82 7c 4e  f5 0e 2f 6c 19 86 3f 26  |..sC..|N../l..?&|
   000001d0  2f e3 85 3f 00 2f e1 be  1a d8 15 2d 1d ab 73 a0  |/..?./.....-..s.|
   000001e0  d4 ee 9a fc 0b cf d6 b2  3f 93 78 4a b1 13 7c 4e  |........?.xJ..|N|
   000001f0  dc 0d 27 db d8 0c 13 35  76 a7 8e d3 45 d4 67 4c  |..'....5v...E.gL|
   00000200  e3 5b 37 bb 98 1e 83 62  c8 8c 6e 38 56 48 a0 20  |.[7....b..n8VH. |
   00000210  70 a0 4d b0 dd 60 e9 ef  83 e3 25 cf 57 ff 0d 21  |p.M..`....%.W..!|
   00000220  28 57 88 3a 1a 74 89 88  de 03 36 df 6a dc 55 c6  |(W.:.t....6.j.U.|
   00000230  0d 31 43 a3 7a c5 d6 d8  c8 81 4f bb 64 95 18 58  |.1C.z.....O.d..X|
   00000240  d3 97 66 a0 4f 93 38 2d  34 77 ca 1b ee 45 36 3d  |..f.O.8-4w...E6=|
   00000250  d8 5d a3 52 37 d6 3f f8  7b b0 2f 64 06 30 d1 01  |.].R7.?.{./d.0..|
   00000260  b2 4e c0 42 ba a3 d2 64  ca 15 6e 6d ae 85 7b 4f  |.N.B...d..nm..{O|
   00000270  91 d9 c9 9f 26 8d 65 0c  13 1d d4 ac 7e 27 7f fa  |....&.e.....~'..|
   00000280  ec 78 14 58 26 3e 90 50  61 6f f1 02 ad 05 64 b4  |.x.X&>.Pao....d.|
   00000290  73 bc 6a b2 bf 35 ca 2b  b7 3c 68 8e af 4e 44 83  |s.j..5.+.<h..ND.|
   000002a0  a0 d8 57 17 75 97 dd 47  ca 5f 3b 1f 4f 18 33 5b  |..W.u..G._;.O.3[|
   000002b0  13 c0 76 c4 8d 57 d0 2e  cc a2 d2 61 df 83 78 3c  |..v..W.....a..x<|
   000002c0  3d fa 92 2f 53 6a 93 b0  85 b8 1d 07 9a bd fb bc  |=../Sj..........|
   000002d0  fa 45 60 92 bd d8 54 95  7d d2 c8 fe 60 16 35 2a  |.E`...T.}...`.5*|
   000002e0  f9 7f d3 c2 2a 48 28 e8  99 fb 1d 6f d1 00 ad 66  |....*H(....o...f|
   000002f0  d0 0b 1c 0e 83 9f 29 43  1e 96 f4 9d df c2 03 9a  |......)C........|
   00000300  6c 32 74 35 5d 31 58 f6  75 32 82 19 73 fb b4 45  |l2t5]1X.u2..s..E|
   00000310  b3 fd 78 ad 8e 33 bc dc  63 23 ab 7e f7 03 8b 9c  |..x..3..c#.~....|
   00000320  f1 13 c0 70 97 b5 69 cb  fd ab 73 4c ea 55 ae 74  |...p..i...sL.U.t|
   00000330  9d 98 c7 ae 78 ab 46 b1  34 0a f5 68 f8 d9 d5 3e  |....x.F.4..h...>|
   00000340  8b f2 d9 a2 96 19 99 0d  3e 42 3c c7 9d 79 35 4e  |........>B<..y5N|
   00000350  d6 36 2e 8b 67 55 4e 62  14 8b 39 1f 73 b1 7d 9b  |.6..gUNb..9.s.}.|
   00000360  f2 a4 5e 4f 3a 70 76 27  3e ae ab 8d 91 5c b5 b2  |..^O:pv'>....\..|
   00000370  65 29 cc 70 4b 34 67 f3  7b 64 ea 48 e2 30 72 c0  |e).pK4g.{d.H.0r.|
   00000380  38 fd 23 8b 48 09 a2 3b  7b c5 62 e4 6f 2e 7e 15  |8.#.H..;{.b.o.~.|
   00000390  7e 5d 6f 1f af 88 89 76  e8 07 df df 58 83 ae 30  |~]o....v....X..0|
   000003a0  c8 27 e8 8d 1e 7c ac 3e  1a c8 3b a8 df 23 0d 35  |.'...|.>..;..#.5|
   000003b0  98 1a ac 7b ee 3d dd 50  64 e3 c5 26 4e 82 d8 35  |...{.=.Pd..&N..5|
   000003c0  70 4d 0e d6 2b 41 fa 4f  52 92 ae 42 3e 41 b8 18  |pM..+A.OR..B>A..|
   000003d0  d5 c3 d5 2b 48 68 0a 1d  fe 81 64 ef d5 6d 47 a4  |...+Hh....d..mG.|
   000003e0  f5 3c de 27 de 13 d1 41  ea db e5 39 60 ba 36 3f  |.<.'...A...9`.6?|
   000003f0  d9 b7 70 d6 23 00 54 5b  43 b4 db 5f b3 7f 7c cf  |..p.#.T[C.._..|.|
   00000400  1a 94 7e 08 95 56 95 27  5a 4a 8b b4 bb 42 f4 3f  |..~..V.'ZJ...B.?|
   00000410  b5 7b 00 df ee 44 0d 40  b0 d0 2c dd de 84 69 01  |.{...D.@..,...i.|
   00000420  1e ad 17 4d 9d 6a d8 01  d5 31 18 e2 3b 06 30 b3  |...M.j...1..;.0.|
   00000430  55 f2 8f 62 c3 3e 54 f4  c2 51 ab a4 68 1c 7f 9d  |U..b.>T..Q..h...|
   00000440  41 1c ce 7a a5 1b dd bb  ae dd ef e5 f8 de 5f a0  |A..z.........._.|
   00000450  34 78 69 df 82 12 4d ba  c6 b4 06 e6 62 72 66 03  |4xi...M.....brf.|
   00000460  e4 db 3d 21 b0 d4 01 4d  3e 45 f6 d2 72 e9 ad ae  |..=!...M>E..r...|
   00000470  f8 9d e2 ff 6c 4f fa 41  6e 46 9c 0f f7 44 1a dc  |....lO.AnF...D..|
   00000480  00 20 40 17 d6 9c 0a 3f  3b 08 68 d1 ae b9 60 f8  |. @....?;.h...`.|
   00000490  3c d0 c2 02 ab 57 c3 65  4e d5 68 d8 70 18 bb a2  |<....W.eN.h.p...|
   000004a0  ef b0 30 9f b7 1d 11 73  9c 9d c7 c7 44 96 f7 46  |..0....s....D..F|
   000004b0  f7 cf ce 99 7b 61 84 6d  26 30 18 61 88 bb 1e 28  |....{a.m&0.a...(|
   000004c0  ea d7 1d b0 43 bb 3f 93  29 06 58 15 39 fe 76 54  |....C.?.).X.9.vT|
   000004d0  77 23 ca 65 66 12 95 a7  2e 8a 48 ac 21 bd 7b 96  |w#.ef.....H.!.{.|
   000004e0  e2 4f 8e 06 19 be 07 26  1f 24 3e 73 88 14 b7 a8  |.O.....&.$>s....|
   000004f0  e3 e1 37 d4 20 c1 af bb  6e 5c 48 18 3d b5 79 8d  |..7. ...n\H.=.y.|
   00000500  94 26 c6 1f c0 ef 00 a3  a2 97 ae c6 bd 3f 7d d9  |.&...........?}.|
   00000510  59 7f aa dd 6b cd 60 b8  52 dc 7d bf 43 e1 01 b6  |Y...k.`.R.}.C...|
   00000520  b0 84 c5 65 e3 54 eb 5c  c7 7f bd 06 35 54 35 f4  |...e.T.\....5T5.|
   00000530  20 9f f7 69 b4 9a dd ac  86 e5 21 9c de a1 e0 3e  | ..i......!....>|
   00000540  21 3d 02 7f 6d 19 b1 92  ec 94 fd 20 44 75 6d c1  |!=..m...... Dum.|
   00000550  1b 04 f3 bb a4 af                                 |......|
  },
  HtlcIndex: (uint64) 103221,
  LogIndex: (uint64) 121241,
  ExtraData: ([]uint8) <nil>
 }
}

@xmrk-btc
Copy link
Author

Could you guys patch #8220 so we can have more info around this area? Thanks!

I am running commit e3761459f52e9c343a759aa55621ce11613bc33d since yesterday around 20:00 CET, should I enable debug logs? I already saw the "unknown channel" message twice with this version, but with log level INFO, going to put CHAN to DBG.

@xmrk-btc
Copy link
Author

Restarted lnd, now running with e376145 cherry-picked over 0.17.2, got this:

2023-11-23 21:35:31.951 [DBG] PEER: Peer(0378a5312ca36773971df43f833b571d024fd7d5d216fbdf7e241b710714ef1be1): Received NodeAnno
uncement(node=0378a5312ca36773971df43f833b571d024fd7d5d216fbdf7e241b710714ef1be1, update_time=2023-11-23 12:45:58 +0100 CET) fr
om 0378a5312ca36773971df43f833b571d024fd7d5d216fbdf7e241b710714ef1be1@18.140.96.179:41240
2023-11-23 21:35:31.951 [DBG] PEER: Peer(0378a5312ca36773971df43f833b571d024fd7d5d216fbdf7e241b710714ef1be1): Received ChannelReestablish(chan_id=e6a6a323037d1a51fa922956d33f375c6f4cb55d06b3a2748908f54ea39b9413, next_local_height=252778, remote_tail_height=259276) from 0378a5312ca36773971df43f833b571d024fd7d5d216fbdf7e241b710714ef1be1@18.140.96.179:41240
2023-11-23 21:35:31.951 [INF] HSWC: ChannelLink(13949ba34ef5088974a2b3065db54c6f5c373fd3562992fa511a7d0323a3a6e6:0): received re-establishment message from remote side
2023-11-23 21:35:31.956 [DBG] PEER: Peer(0378a5312ca36773971df43f833b571d024fd7d5d216fbdf7e241b710714ef1be1): Received UpdateFulfillHTLC(chan_id=e6a6a323037d1a51fa922956d33f375c6f4cb55d06b3a2748908f54ea39b9413, id=169699, pre_image=<redacted> ) from 0378a5312ca36773971df43f833b571d024fd7d5d216fbdf7e241b710714ef1be1@18.140.96.179:41240
2023-11-23 21:35:31.957 [DBG] HSWC: ChannelLink(13949ba34ef5088974a2b3065db54c6f5c373fd3562992fa511a7d0323a3a6e6:0): loaded 0 fwd pks
2023-11-23 21:35:31.957 [DBG] PEER: Peer(0378a5312ca36773971df43f833b571d024fd7d5d216fbdf7e241b710714ef1be1): Received UpdateAddHTLC(chan_id=e6a6a323037d1a51fa922956d33f375c6f4cb55d06b3a2748908f54ea39b9413, id=9469, amt=20001945 mSAT, expiry=818536, hash=093f2322e555358bfb6025f907328a45ffedf3979a7bf71f3423fb232f76300c) from 0378a5312ca36773971df43f833b571d024fd7d5d216fbdf7e241b710714ef1be1@18.140.96.179:41240
2023-11-23 21:35:31.957 [ERR] HSWC: ChannelLink(13949ba34ef5088974a2b3065db54c6f5c373fd3562992fa511a7d0323a3a6e6:0): failing link: unable to handle upstream settle with error: invalid update
2023-11-23 21:35:31.957 [ERR] HSWC: ChannelLink(13949ba34ef5088974a2b3065db54c6f5c373fd3562992fa511a7d0323a3a6e6:0): link failed, exiting htlcManager
2023-11-23 21:35:31.957 [INF] HSWC: ChannelLink(13949ba34ef5088974a2b3065db54c6f5c373fd3562992fa511a7d0323a3a6e6:0): stopping
2023-11-23 21:35:31.957 [INF] HSWC: ChannelLink(13949ba34ef5088974a2b3065db54c6f5c373fd3562992fa511a7d0323a3a6e6:0): exited

I have 3 HTLCs right now with that peer, 2 of them have forwarding_channel = 0 (I see this in lncli listchannels output, pending_htlcs).

There is no log category CHAN, I am running with lncli debuglevel --level CHAC=debug,HSWC=debug,PEER=debug .

@ziggie1984
Copy link
Collaborator

Thanks for helping out, we are already working on a fix.

@ziggie1984
Copy link
Collaborator

ziggie1984 commented Dec 7, 2023

Fixed with #8220 (lnd 17.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unintended code behaviour htlcswitch needs triage P1 MUST be fixed or reviewed
Projects
None yet
Development

No branches or pull requests

4 participants