Closed mrfelton closed 10 months ago
I find this log abnormal,
2023-12-22 03:10:57.007 [INF] CNCT: Marking ChannelPoint(dbe8a0325a9ddb75489e446b01b9f96d019809171c2fda44374ad40b0da7cd2e:0) fully resolved
As this is a channel opening and nothing should be resolved by contract court. Could you do a search over dbe8a0325a9ddb75489e446b01b9f96d019809171c2fda44374ad40b0da7cd2e
and post all the relevant logs?
Could you do a search over dbe8a0325a9ddb75489e446b01b9f96d019809171c2fda44374ad40b0da7cd2e and post all the relevant logs?
that is what the logs above are. Those show all references to that channel point and the pending channel id
The above log means this line was executed, https://github.com/lightningnetwork/lnd/blob/ab8fb2c9c336232f86fa6bdbcac09027ec46c39d/contractcourt/chain_arbitrator.go#L442
which is a logging generated from the method ResolveContract
, but we know it's not from contractcourt
here, because there's no relevant logging:
there's another occurrence in contractcourt
, which is when the channel gets resolved, but since it's not force closed, so that's also not the case.
Then the only place is in rpcserver
, inside abandonChan
,
https://github.com/lightningnetwork/lnd/blob/ab8fb2c9c336232f86fa6bdbcac09027ec46c39d/rpcserver.go#L2793
and this can only happen via RPC BatchOpenChannel
or AbandonChannel
. So what commands did you use to open the channel and, do you have any occurrence of these RPC calls in your logs?
~The channel was opened with the OpenChannel
RPC. Neither BatchOpenChannel
or AbandonChannel
was called.~
EDIT: The channel was opened using a PSBT flow. And looking at our code it is possible that abandon channel could have been called as we do call this in the event that we detected that a channel opening attempt failed. Will need to do some more digging in our application logs to determine the exact sequence of events.
A little more digging in our application logs shows that indeed it does look related to the double spend. It appears that the channel opening attempt failed due the double spend - I see transaction rejected: output already spent
error from when the PSBT to open the channel was published.
Then, as part of an automated cleanup it seems we have called abandon channel. We do this because we have found that if we do not abandon the failed channel opening attempt, it will remain stuck in a pending state forever.
Do you use the psbt flow in combination with the lnd psbt fund
cmd, otherwise pretty strange why it used an already spent output.
Yes, It's done using the WalletKit FundPsbt
RPC. I suspect we may have had a race condition with another transaction attempting to use the same inputs.
Yes either that, or try not to use unconfirmed outputs for now because I think it has to do with the sweeping of the anchor output which is RBFed by a third party
Ok, interesting. We do currently set SpendUnconfirmed
when funding the Psbt.
After updating to not spend unconfirmed outputs we no longer see this problem.
I think it has to do with the sweeping of the anchor output which is RBFed by a third party
Is there an existing issue that tracks the root problem here?
Closing in favor of https://github.com/lightningnetwork/lnd/issues/7602 (identified as the root problem).
Hi, we have a reoccurring scenario in which channel open attempts fail - no channel opening transaction is broadcast, and the channel does not exist in the node's channel database after the opening attempt, but the remote node does still have a record of the channel in its db and has it stuck in a pending open state.
I'd like to understand how/why this happens, and what could be done to prevent it.
Here are some logs related to one of these events (we have had at least three of them in the last couple of weeks).
After this, there seems to be no record of the channel or it's funding transaction on the node or in the mempool.
However, the channel shows up on the remote node as pending open:
After restarting the node some time later, some log messages about this channel do show up during the restart, although there is no change with the channel state (or lack of it).
I believe the remote node will eventually forget about this channel after some time (~2 weeks from the opening attempt), however it's problematic for us as it leaves the remote node in a state where it thinks there is a pending channel, which counts towards
maxpendingchannels
and can result in the remote node rejecting additional channel opens from the node.It seems that the channel opening transaction will never get broadcast - so is this channel safe to abandon on the remote side in order to clear it from their pending channels list?
Why could this have happened in the first place? Thanks!
Is the
transaction rejected: output already spent
log entry related? I can't tell because I can't finds anything in that log message, or in theRemoved invalid transaction: (*wire.MsgTx)(0xc022e77080)
log message that proceeds it that correlates with the channel open request, other than the fact that it occurred right during the middle of the channel open attempt at the same timestamp.If it is related to the doublespend, how can we prevent channel opening attempts from double spends that cause failures or detect this and self heal more gracefully?