Skip to content

Commit

Permalink
fixup! Add more splice RBF reconnection tests
Browse files Browse the repository at this point in the history
  • Loading branch information
t-bast committed Dec 12, 2024
1 parent 452fccc commit 2e1e7db
Showing 1 changed file with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik
assert(postSpliceState.commitments.latest.localCommit.spec.htlcs.collect(outgoing).toSeq.map(_.amountMsat).sum == outgoingHtlcs)
}

def resolveHtlcs(f: FixtureParam, htlcs: TestHtlcs, spliceOutFee: Satoshi): Unit = {
def resolveHtlcs(f: FixtureParam, htlcs: TestHtlcs, spliceOutFee: Satoshi = 0.sat): Unit = {
import f._

checkPostSpliceState(f, spliceOutFee)
Expand Down Expand Up @@ -737,7 +737,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik
test("recv CMD_SPLICE (splice-in + splice-out)") { f =>
val htlcs = setupHtlcs(f)
initiateSplice(f, spliceIn_opt = Some(SpliceIn(500_000 sat)), spliceOut_opt = Some(SpliceOut(100_000 sat, defaultSpliceOutScriptPubKey)))
resolveHtlcs(f, htlcs, spliceOutFee = 0.sat)
resolveHtlcs(f, htlcs)
}

test("recv CMD_BUMP_FUNDING_FEE (splice-in + splice-out)") { f =>
Expand Down Expand Up @@ -1635,7 +1635,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik
awaitCond(alice.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)
awaitCond(bob.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)

resolveHtlcs(f, htlcs, 0 sat)
resolveHtlcs(f, htlcs)
}

test("disconnect (commit_sig received by alice)") { f =>
Expand Down Expand Up @@ -1683,7 +1683,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik
awaitCond(alice.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)
awaitCond(bob.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)

resolveHtlcs(f, htlcs, 0 sat)
resolveHtlcs(f, htlcs)
}

test("disconnect (tx_signatures sent by bob)") { f =>
Expand Down Expand Up @@ -1731,7 +1731,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik
awaitCond(alice.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)
awaitCond(bob.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)

resolveHtlcs(f, htlcs, 0 sat)
resolveHtlcs(f, htlcs)
}

test("disconnect (tx_signatures received by alice)") { f =>
Expand Down Expand Up @@ -1777,7 +1777,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik
awaitCond(alice.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)
awaitCond(bob.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)

resolveHtlcs(f, htlcs, 0 sat)
resolveHtlcs(f, htlcs)
}

test("disconnect (tx_signatures received by alice, zero-conf)", Tag(ChannelStateTestsTags.ZeroConf), Tag(ChannelStateTestsTags.AnchorOutputsZeroFeeHtlcTxs)) { f =>
Expand Down Expand Up @@ -1823,7 +1823,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik
awaitCond(alice.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)
awaitCond(bob.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)

resolveHtlcs(f, htlcs, spliceOutFee = 0.sat)
resolveHtlcs(f, htlcs)
}

test("disconnect (tx_signatures sent by alice, splice confirms while bob is offline)") { f =>
Expand Down Expand Up @@ -1945,7 +1945,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik

val rbfTx = confirmRbfTx(f)
assert(rbfTx.txid != spliceTx.txid)
resolveHtlcs(f, htlcs, 0 sat)
resolveHtlcs(f, htlcs)
}

test("disconnect (RBF commit_sig received by alice)", Tag(ChannelStateTestsTags.FundingDeeplyBuried)) { f =>
Expand Down Expand Up @@ -1992,7 +1992,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik

val rbfTx = confirmRbfTx(f)
assert(rbfTx.txid != spliceTx.txid)
resolveHtlcs(f, htlcs, 0 sat)
resolveHtlcs(f, htlcs)
}

test("disconnect (RBF tx_signatures received by alice)", Tag(ChannelStateTestsTags.FundingDeeplyBuried)) { f =>
Expand Down Expand Up @@ -2040,7 +2040,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik

val rbfTx = confirmRbfTx(f)
assert(rbfTx.txid != spliceTx.txid)
resolveHtlcs(f, htlcs, 0 sat)
resolveHtlcs(f, htlcs)
}

test("don't resend splice_locked when zero-conf channel confirms", Tag(ChannelStateTestsTags.ZeroConf), Tag(ChannelStateTestsTags.AnchorOutputsZeroFeeHtlcTxs)) { f =>
Expand Down Expand Up @@ -2740,7 +2740,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik
Transaction.correctlySpends(commitTx, Map(c.commitInput.outPoint -> c.commitInput.txOut), ScriptFlags.STANDARD_SCRIPT_VERIFY_FLAGS)
}

resolveHtlcs(f, htlcs, spliceOutFee = 0.sat)
resolveHtlcs(f, htlcs)
}

test("recv CMD_SPLICE (splice-in + splice-out) with pending htlcs, resolved after splice locked", Tag(ChannelStateTestsTags.AnchorOutputsZeroFeeHtlcTxs)) { f =>
Expand All @@ -2759,7 +2759,7 @@ class NormalSplicesStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLik
awaitCond(alice.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)
awaitCond(bob.stateData.asInstanceOf[DATA_NORMAL].commitments.active.size == 1)

resolveHtlcs(f, htlcs, spliceOutFee = 0.sat)
resolveHtlcs(f, htlcs)
}

test("recv multiple CMD_SPLICE (splice-in, splice-out)") { f =>
Expand Down

0 comments on commit 2e1e7db

Please sign in to comment.