@@ -277,7 +277,7 @@ class OfflineStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
277
277
assert(bob.stateData.asInstanceOf [DATA_NORMAL ].commitments.localCommit.index === 4 )
278
278
}
279
279
280
- test(" discover that we have a revoked commitment" ) { f =>
280
+ test(" reconnect with an outdated commitment" ) { f =>
281
281
import f ._
282
282
283
283
val (ra1, htlca1) = addHtlc(250000000 msat, alice, bob, alice2bob, bob2alice)
@@ -327,7 +327,7 @@ class OfflineStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
327
327
Transaction .correctlySpends(claimMainOutput, bobCommitTx :: Nil , ScriptFlags .STANDARD_SCRIPT_VERIFY_FLAGS )
328
328
}
329
329
330
- test(" discover that they have a more recent commit than the one we know (but counterparty can't tell)" ) { f =>
330
+ test(" reconnect with an outdated commitment (but counterparty can't tell)" ) { f =>
331
331
import f ._
332
332
333
333
// we start by storing the current state
@@ -356,57 +356,11 @@ class OfflineStateSpec extends TestKitBaseClass with FixtureAnyFunSuiteLike with
356
356
val reestablishA = alice2bob.expectMsgType[ChannelReestablish ]
357
357
val reestablishB = bob2alice.expectMsgType[ChannelReestablish ]
358
358
359
- // bob cannot detect that alice is late in this scenario (because alice has just missed one state)
359
+ // bob cannot detect that alice is late (because alice has just missed one state), so it starts normally
360
360
alice2bob.forward(bob, reestablishA)
361
361
bob2alice.expectMsgType[RevokeAndAck ]
362
362
bob2alice.expectMsgType[CommitSig ]
363
- bob2alice.expectNoMessage(100 millis)
364
- bob2blockchain.expectNoMessage(100 millis)
365
-
366
- // alice realizes she has an old state when receiving Bob's reestablish
367
- bob2alice.forward(alice, reestablishB)
368
- // alice asks bob to publish its current commitment
369
- val error = alice2bob.expectMsgType[Error ]
370
- assert(error === Error (channelId(alice), PleasePublishYourCommitment (channelId(alice)).getMessage))
371
- alice2bob.forward(bob)
372
-
373
- // alice now waits for bob to publish its commitment
374
- awaitCond(alice.stateName == WAIT_FOR_REMOTE_PUBLISH_FUTURE_COMMITMENT )
375
-
376
- // bob is nice and publishes its commitment
377
- alice ! WatchFundingSpentTriggered (bobCommitTx)
378
-
379
- // alice is able to claim its main output
380
- val claimMainOutput = alice2blockchain.expectMsgType[PublishRawTx ].tx
381
- Transaction .correctlySpends(claimMainOutput, bobCommitTx :: Nil , ScriptFlags .STANDARD_SCRIPT_VERIFY_FLAGS )
382
- }
383
-
384
- test(" discover that they have a more recent commit than the one we know" ) { f =>
385
- import f ._
386
-
387
- // we start by storing the current state
388
- val oldStateData = alice.stateData
389
- // then we add an htlc and sign it
390
- addHtlc(250000000 msat, alice, bob, alice2bob, bob2alice)
391
- crossSign(alice, bob, alice2bob, bob2alice)
392
-
393
- // we keep track of bob commitment tx for later
394
- val bobCommitTx = bob.stateData.asInstanceOf [DATA_NORMAL ].commitments.localCommit.commitTxAndRemoteSig.commitTx.tx
395
-
396
- // we simulate a disconnection
397
- disconnect(alice, bob)
398
-
399
- // then we manually replace alice's state with an older one
400
- alice.setState(OFFLINE , oldStateData)
401
-
402
- // then we reconnect them
403
- reconnect(alice, bob, alice2bob, bob2alice)
404
-
405
- val reestablishA = alice2bob.expectMsgType[ChannelReestablish ]
406
- val reestablishB = bob2alice.expectMsgType[ChannelReestablish ]
407
-
408
- // bob realizes that alice is late and goes in standby
409
- alice2bob.forward(bob, reestablishA)
363
+ bob2blockchain.expectMsgType[WatchFundingDeeplyBuried ]
410
364
bob2alice.expectNoMessage(100 millis)
411
365
bob2blockchain.expectNoMessage(100 millis)
412
366
0 commit comments