Skip to content

Commit

Permalink
Improve splice tests
Browse files Browse the repository at this point in the history
And fix a bug when an inactive revoked commitment is published.
  • Loading branch information
t-bast committed Dec 20, 2023
1 parent 61f3082 commit b7b4364
Show file tree
Hide file tree
Showing 3 changed files with 295 additions and 375 deletions.
8 changes: 4 additions & 4 deletions src/commonMain/kotlin/fr/acinq/lightning/channel/Helpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,10 @@ object Helpers {
// NB: from the point of view of the remote, their incoming htlcs are our outgoing htlcs
htlcsInRemoteCommit.incomings().toSet() - localCommit.spec.htlcs.outgoings().toSet()
}
revokedCommitPublished.map { it.commitTx.txid }.contains(tx.txid) -> {
// a revoked commitment got confirmed: we will claim its outputs, but we also need to fail htlcs that are pending in the latest commitment
(nextRemoteCommit ?: remoteCommit).spec.htlcs.incomings().toSet()
}
remoteCommit.txid == tx.txid -> when (nextRemoteCommit) {
null -> emptySet() // their last commitment got confirmed, so no htlcs will be overridden, they will timeout or be fulfilled on chain
else -> {
Expand All @@ -970,10 +974,6 @@ object Helpers {
nextRemoteCommit.spec.htlcs.incomings().toSet() - localCommit.spec.htlcs.outgoings().toSet()
}
}
revokedCommitPublished.map { it.commitTx.txid }.contains(tx.txid) -> {
// a revoked commitment got confirmed: we will claim its outputs, but we also need to fail htlcs that are pending in the latest commitment
(nextRemoteCommit ?: remoteCommit).spec.htlcs.incomings().toSet()
}
else -> emptySet()
}

Expand Down

0 comments on commit b7b4364

Please sign in to comment.