htlcswitch: check for signature owed in link

Previously the channel method FullySynced was used to decide whether to
send a new commit sig message. However, it could happen that FullySynced
was false, but that we didn't owe a commitment signature. Instead we
were waiting on the other party to send us a signature. If that
happened, we'd send out an empty commit sig. This commit modifies the
condition that triggers a new commit sig and fixes this deviation from
the spec.
This commit is contained in:
Joost Jager committed 2019-11-06 09:21:23 +01:00
1 parent 64f4421d6c
commit f59b4d62bf
3 files changed
+9 -31

No files matched your search

+2 -2
View File
@@ -1103,7 +1103,7 @@ out:
// update in some time, check to see if we have any
// pending updates we need to commit due to our
// commitment chains being desynchronized.
if l.channel.FullySynced() {
if !l.channel.OweCommitment(true) {
continue
}
@@ -1808,7 +1808,7 @@ func (l *channelLink) handleUpstreamMsg(msg lnwire.Message) {
// If both commitment chains are fully synced from our PoV,
// then we don't need to reply with a signature as both sides
// already have a commitment with the latest accepted.
if l.channel.FullySynced() {
if !l.channel.OweCommitment(true) {
return
}