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

Multiple peers unilaterally closing immediately upon new channel confirmation: "rejected commitment" #3596

Closed
whitslack opened this issue Mar 18, 2020 · 4 comments

Comments

@whitslack
Copy link
Collaborator

Issue and Steps to Reproduce

I opened twelve channels in quick succession, and five of them were unilaterally closed by the peer as soon as they reached 3 confirmations. The debug logs for all five contain a message that says rejected commitment with an invalid_commit_sig. Also I see peer_in WIRE_ERROR, which to me says that the peer didn't like something my node did.

Here are the debug logs from four of the five failed channels. (The fifth log contains many megabytes of channel update messages.) I'm not sure why there are so many SKIPPED log events scattered throughout them, but maybe there is enough intact information across all of them to astertain what went wrong.

For the sake of making this searchable, here's a summary of the sequence of events I see in these logs. These might be slightly out of order because I had to piece them together from multiple logs due to all the SKIPPED events.

  1. Funding tx … depth 3 of 3
  2. State changed from CHANNELD_AWAITING_LOCKIN to CHANNELD_NORMAL
  3. peer_out WIRE_FUNDING_LOCKED
  4. Setting REMOTE feerate to 17890
  5. Feerate: SENT_ADD_HTLC->SENT_ADD_COMMIT REMOTE now 17890
  6. peer_out WIRE_UPDATE_FEE
  7. peer_out WIRE_COMMITMENT_SIGNED
  8. peer_in WIRE_ERROR
  9. Peer transient failure in CHANNELD_NORMAL: channeld: (ignoring) channel …: rejected commitment: commit_height=1, invalid_commit_sig=…, commit_tx=…, sig_hash=…

getinfo output

$ lightning-cli getinfo | jq '{binding, version, blockheight, network, "lightning-dir"}'
{
  "binding": [
    {
      "type": "ipv6",
      "address": "::",
      "port": 9735
    },
    {
      "type": "ipv4",
      "address": "0.0.0.0",
      "port": 9735
    }
  ],
  "version": "0.8.1",
  "blockheight": 622039,
  "network": "bitcoin",
  "lightning-dir": "/var/lib/lightning/bitcoin"
}
@whitslack
Copy link
Collaborator Author

@niftynei
Copy link
Collaborator

niftynei commented Apr 7, 2020

In all 3 of the logs you sent, the peer closed the channel on you. Seems like something about the feerate update that we send on channel open isn't being well understood by the peer, as they're rejecting the subsequent signature on the commitment update.

The basic flow is:

  • The channel opens "log": "peer_out WIRE_FUNDING_LOCKED"
  • clightning decides to update the feerate "log": "Setting REMOTE feerate to 5034"
  • clightning creates and sends a new commitment signature (using the new feerate)
  • the peer rejects the updated commitment signature "log": "Peer transient failure in CHANNELD_NORMAL: channeld: (ignoring) channel cf27ceadc6d3b6a1473f3da92f89301d4465e0416ab29a0e75b8c833a2d7709f: rejected commitment: commit_height=1, invalid_commit_sig=304402202f6a58cde11173b5df32d5c1e913d75a3a21c05ba1a2cbd1bfa16f016c2d3379022075a59d54b3e5df28dec46aaf91aef9f418062ccf7e7f9f949cdbed449f44c8b8, commit_tx=0200000001cf27ceadc6d3b6a1473f3da92f89301d4465e0416ab29a0e75b8c833a2d7709f000000000048819480011e290f0000000000160014022d2657c1b2080c29babffc5f628af1401e60ca77872020, sig_hash=6cabe69f87b30ed427568772eaeaec6860afc9df01ac56699355c61177b5cd31"
  • we mark it as a temporary failure, and try again a few seconds later "log": "Will try reconnect in 60 seconds"
  • we reconnect, they close the channel "log": "Resolved FUNDING_TRANSACTION/FUNDING_OUTPUT by THEIR_UNILATERAL (31ebb7c854b0608455595e098adb356dcf338906c229f0718ae1b810e223a439)"

... for 8 of your channels. Seems like there's a feerate bug interop problem here. Thanks for reporting.

@niftynei
Copy link
Collaborator

niftynei commented Apr 7, 2020

Digging a bit more, the commitment tx that your peer is expecting a signature for doesn't have the feerate update applied. (The original commitment tx amount is still shown in the commitment tx sent back in the error message from your peer).

This seems very possibly related to a (recently) patched known bug in LND .

@whitslack
Copy link
Collaborator Author

@niftynei: Thank you for that analysis. I had a hunch it was due to an LND bug. 😉

rustyrussell added a commit to rustyrussell/lightning that referenced this issue Apr 8, 2020
Sending update_fee immediately after channel establishment seems to
upset LND, so work around it by deferring it.  The reason we increase
the fee after establishment is because now we might need to close the
channel in a hurry due to htlcs, but until there are htlcs that's
unnecessary.

Fixes: ElementsProject#3596
Signed-off-by: Rusty Russell <[email protected]>
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Apr 9, 2020
Sending update_fee immediately after channel establishment seems to
upset LND, so work around it by deferring it.  The reason we increase
the fee after establishment is because now we might need to close the
channel in a hurry due to htlcs, but until there are htlcs that's
unnecessary.

Fixes: ElementsProject#3596
Signed-off-by: Rusty Russell <[email protected]>
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Apr 11, 2020
Sending update_fee immediately after channel establishment seems to
upset LND, so work around it by deferring it.  The reason we increase
the fee after establishment is because now we might need to close the
channel in a hurry due to htlcs, but until there are htlcs that's
unnecessary.

Fixes: ElementsProject#3596
Signed-off-by: Rusty Russell <[email protected]>
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Apr 11, 2020
Sending update_fee immediately after channel establishment seems to
upset LND, so work around it by deferring it.  The reason we increase
the fee after establishment is because now we might need to close the
channel in a hurry due to htlcs, but until there are htlcs that's
unnecessary.

Fixes: ElementsProject#3596
Changelog-Changed: Added workaround for lnd rejecting our commitment_signed when we send an update_fee after channel confirmed.
Signed-off-by: Rusty Russell <[email protected]>
rustyrussell added a commit to rustyrussell/lightning that referenced this issue Apr 13, 2020
Sending update_fee immediately after channel establishment seems to
upset LND, so work around it by deferring it.  The reason we increase
the fee after establishment is because now we might need to close the
channel in a hurry due to htlcs, but until there are htlcs that's
unnecessary.

Fixes: ElementsProject#3596
Changelog-Changed: Added workaround for lnd rejecting our commitment_signed when we send an update_fee after channel confirmed.
Signed-off-by: Rusty Russell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants