Description
Background
My old crashed node is running in recovery mode, and repeatedly tries to spend already spent outputs. It constructs a transaction with multiple inputs, some of which are spent, so the transaction is invalid. This happens because I used chantools to close and sweep some channels, so I guess lnd doesn't expect channels to be closed by external tool.
I think lnd should be more permissive especially in recovery mode. The fix seems almost trivial, just check whether the output is spent, or perhaps if you are worried about performance, check inputs only if the transaction is rejected. I'd also like to see which channels haven't been fully resolved (as output of lncli pendingchannels
), taking into account such external actions as closing with chantools. Currently, I think pendingchannels returns all channels which were open at the moment of crash (I am not sure, I only checked the channel count and it is too high.)
Few examples of spent outputs which lnd tries to spend again:
bc37f08100db7a6cb40c1d0c0f3aab7becc93d5c2eb64adf41a9b11a56fc7542:3 CommitmentToRemoteConfirmed
d2d95e807b9065098b444f16329540b34bf599e132ffc956250c1dfb74ae30ae:1 CommitmentNoDelayTweakless
43a284419986060bdd71d88753cf2e5c39acf377df466fbd591b789797610e38:0 CommitmentAnchor
Your environment
- version of
lnd
: 0.18.4 (but also happened with 0.17.something) bitcoind
: 0.28