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

Accept commit_sig without changes #988

Merged
merged 2 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,11 @@ object Commitments {
// we will reply to this sig with our old revocation hash preimage (at index) and our next revocation hash (at index + 1)
// and will increment our index

if (!remoteHasChanges(commitments))
throw CannotSignWithoutChanges(commitments.channelId)
// lnd sometimes sends a new signature without any changes, which is a (harmless) spec violation
if (!remoteHasChanges(commitments)) {
// throw CannotSignWithoutChanges(commitments.channelId)
log.warning("received a commit sig with no changes (probably coming from lnd)")
}

// check that their signature is valid
// signatures are now optional in the commit message, and will be sent only if the other party is actually
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,13 +714,14 @@ class NormalStateSpec extends TestkitBaseClass with StateTestsHelperMethods {
assert(bob.stateData.asInstanceOf[DATA_NORMAL].commitments.localCommit.publishableTxs.commitTx.tx.txOut.count(_.amount == Satoshi(50000)) == 2)
}

test("recv CommitSig (no changes)") { f =>
ignore("recv CommitSig (no changes)") { f =>
import f._
val tx = bob.stateData.asInstanceOf[DATA_NORMAL].commitments.localCommit.publishableTxs.commitTx.tx
val sender = TestProbe()
// signature is invalid but it doesn't matter
sender.send(bob, CommitSig(ByteVector32.Zeroes, ByteVector.fill(64)(0), Nil))
bob2alice.expectMsgType[Error]
val error = bob2alice.expectMsgType[Error]
assert(new String(error.data.toArray).startsWith("cannot sign when there are no changes"))
awaitCond(bob.stateName == CLOSING)
// channel should be advertised as down
assert(channelUpdateListener.expectMsgType[LocalChannelDown].channelId === bob.stateData.asInstanceOf[DATA_CLOSING].channelId)
Expand All @@ -739,6 +740,7 @@ class NormalStateSpec extends TestkitBaseClass with StateTestsHelperMethods {
sender.send(bob, CommitSig(ByteVector32.Zeroes, ByteVector.fill(64)(0), Nil))
val error = bob2alice.expectMsgType[Error]
assert(new String(error.data.toArray).startsWith("invalid commitment signature"))
awaitCond(bob.stateName == CLOSING)
bob2blockchain.expectMsg(PublishAsap(tx))
bob2blockchain.expectMsgType[PublishAsap]
bob2blockchain.expectMsgType[WatchConfirmed]
Expand Down