Skip to content

Commit

Permalink
fixed mixed up comments
Browse files Browse the repository at this point in the history
Discovered this while working on #1838.

In the following scenario, at reconnection:
- `localCommit.index = 7`
- `nextRemoteRevocationNumber = 6`

So when `localCommit.index == nextRemoteRevocationNumber + 1` we must retransmit the revocation.

```
          local              remote
            |                   |
            |  (no pending sig) |
 commit = 6 |                   | next rev = 6
            |<----- sig 7 ------|
 commit = 7 |                   |
            |-- rev 6 --> ?     |
            |                   |
            |  (disconnection)  |
            |                   |
```
  • Loading branch information
pm47 committed Oct 15, 2021
1 parent 786897c commit 16b8b52
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,10 @@ object Helpers {
*/
def checkLocalCommit(d: HasCommitments, nextRemoteRevocationNumber: Long): Boolean = {
if (d.commitments.localCommit.index == nextRemoteRevocationNumber) {
// they just sent a new commit_sig, we have received it but they didn't receive our revocation
// we are in sync
true
} else if (d.commitments.localCommit.index == nextRemoteRevocationNumber + 1) {
// we are in sync
// they just sent a new commit_sig, we have received it but they didn't receive our revocation
true
} else if (d.commitments.localCommit.index > nextRemoteRevocationNumber + 1) {
// remote is behind: we return true because things are fine on our side
Expand Down

0 comments on commit 16b8b52

Please sign in to comment.