Skip to content

Commit 2fcdc4a

Browse files
committed
Modify for interop testing stfu to LND
Used for this test: 3) LND sends `add_update_htlc` and Eclair sends `stfu` before sending `revoke_and_ack` + `commit_sig` LND sends `revoke_and_ack` before sending `stfu`
1 parent 87b141f commit 2fcdc4a

File tree

1 file changed

+5
-4
lines changed
  • eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm

1 file changed

+5
-4
lines changed

eclair-core/src/main/scala/fr/acinq/eclair/channel/fsm/Channel.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,9 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
452452
}
453453

454454
case Event(add: UpdateAddHtlc, d: DATA_NORMAL) =>
455+
val stfu = Stfu(d.channelId, initiator = true)
455456
d.commitments.receiveAdd(add, nodeParams.currentFeerates, nodeParams.onChainFeeConf) match {
456-
case Right(commitments1) => stay() using d.copy(commitments = commitments1)
457+
case Right(commitments1) => stay() using d.copy(commitments = commitments1) sending stfu
457458
case Left(cause) => handleLocalError(cause, d, Some(add))
458459
}
459460

@@ -627,11 +628,11 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
627628
(d.copy(commitments = commitments1, spliceStatus = SpliceStatus.InitiatorQuiescent(cmd)), Seq(revocation, stfu))
628629
case _: SpliceStatus.ReceivedStfu if commitments1.localIsQuiescent =>
629630
// should be three pending but commited updates to the channel
630-
val ids = commitments1.active.head.localCommit.spec.htlcs.collect({ case htlc => htlc.add.id }).toSeq
631631
val stfu = Stfu(d.channelId, initiator = false)
632+
/*
633+
val ids = commitments1.active.head.localCommit.spec.htlcs.collect({ case htlc => htlc.add.id }).toSeq
632634
// UpdateFee
633635
val Right((commitments2, fee)) = commitments1.sendFee(CMD_UPDATE_FEE(FeeratePerKw(1000 sat)), nodeParams.onChainFeeConf)
634-
/*
635636
// UpdateFailHtlc
636637
val Right((commitments3, fail)) = commitments2.sendFail(CMD_FAIL_HTLC(ids.head, Right(TemporaryNodeFailure())), nodeParams.privateKey)
637638
// UpdateFailMalformedHtlc
@@ -643,7 +644,7 @@ class Channel(val nodeParams: NodeParams, val wallet: OnChainChannelFunder with
643644
val cmdAdd = CMD_ADD_HTLC(ActorRef.noSender, 6666 msat, paymentHash, expiry, emptyOnionPacket, None, Origin.LocalHot(self, UUID.randomUUID()))
644645
val Right((commitments5, add)) = commitments4.sendAdd(cmdAdd, nodeParams.currentBlockHeight, nodeParams.channelConf, nodeParams.currentFeerates, nodeParams.onChainFeeConf)
645646
*/
646-
(d.copy(commitments = commitments2, spliceStatus = SpliceStatus.NonInitiatorQuiescent), Seq(revocation, stfu, fee))
647+
(d.copy(commitments = commitments1, spliceStatus = SpliceStatus.NonInitiatorQuiescent), Seq(revocation, stfu))
647648
case _ =>
648649
(d.copy(commitments = commitments1), Seq(revocation))
649650
}

0 commit comments

Comments
 (0)