From 8c7484256eed13cb3e7094070b3403346adf1196 Mon Sep 17 00:00:00 2001 From: pm47 Date: Thu, 28 Apr 2016 19:07:47 +0200 Subject: [PATCH] includes all IN msg in commit tx --- .../src/main/scala/fr/acinq/eclair/channel/Channel.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eclair-demo/src/main/scala/fr/acinq/eclair/channel/Channel.scala b/eclair-demo/src/main/scala/fr/acinq/eclair/channel/Channel.scala index dc6cdf1d7..0cee328a5 100644 --- a/eclair-demo/src/main/scala/fr/acinq/eclair/channel/Channel.scala +++ b/eclair-demo/src/main/scala/fr/acinq/eclair/channel/Channel.scala @@ -535,8 +535,8 @@ class Channel(val them: ActorRef, val blockchain: ActorRef, val params: OurChann case Event(msg@update_commit(theirSig, theirAck), d@DATA_NORMAL(ack_in, ack_out, ourParams, theirParams, shaChain, htlcIdx, staged, previousCommitment, ReadyForSig(theirNextRevocationHash))) => // counterparty initiated a new commitment - val committed_changes = staged.takeWhile(c => c.direction == IN || c.ack <= theirAck) - val uncommitted_changes = staged.drop(committed_changes.size) + val committed_changes = staged.filter(c => c.direction == IN || c.ack <= theirAck) + val uncommitted_changes = staged.filterNot(committed_changes.contains(_)) // TODO : we should check that this is the correct state (see acknowledge discussion) val proposal = UpdateProposal(previousCommitment.index + 1, previousCommitment.state.commit_changes(committed_changes), theirNextRevocationHash) val ourRevocationHash = Crypto.sha256(ShaChain.shaChainFromSeed(ourParams.shaSeed, proposal.index))