Skip to content

Commit

Permalink
fixup! Ignore previously received commit_sig
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bast committed Sep 22, 2023
1 parent c7c521b commit ac958ee
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ data class Normal(
is InteractiveTxSigningSessionAction.SendTxSigs -> sendSpliceTxSigs(spliceStatus.origins, action, cmd.message.channelData)
}
}
commitments.params.channelFeatures.hasFeature(Feature.DualFunding) && cmd.message.batchSize == 1 && commitSigAlreadyReceived(cmd.message) -> {
commitments.params.channelFeatures.hasFeature(Feature.DualFunding) && ignoreRetransmittedCommitSig(cmd.message) -> {
// We haven't received our peer's tx_signatures for the latest funding transaction and asked them to resend it on reconnection.
// They also resend their corresponding commit_sig, but we have already received it so we should ignore it.
// Note that the funding transaction may have confirmed while we were offline.
Expand Down Expand Up @@ -734,11 +734,11 @@ data class Normal(
return Pair(nextState, actions)
}

private fun commitSigAlreadyReceived(commit: CommitSig): Boolean {
// If we already have a signed commitment transaction containing their signature,
// we must have previously received that commit_sig.
/** This function should be used to ignore a commit_sig that we've already received. */
private fun ignoreRetransmittedCommitSig(commit: CommitSig): Boolean {
// If we already have a signed commitment transaction containing their signature, we must have previously received that commit_sig.
val commitTx = commitments.latest.localCommit.publishableTxs.commitTx.tx
return commitTx.txIn.first().witness.stack.contains(Scripts.der(commit.signature, SigHash.SIGHASH_ALL))
return commit.batchSize == 1 && commitTx.txIn.first().witness.stack.contains(Scripts.der(commit.signature, SigHash.SIGHASH_ALL))
}

/** If we haven't completed the signing steps of an interactive-tx session, we will ask our peer to retransmit signatures for the corresponding transaction. */
Expand Down

0 comments on commit ac958ee

Please sign in to comment.