@@ -246,33 +246,39 @@ module Channel =
246246 let remoteSigPairOfLocalTx = ( theirFundingPk, TransactionSignature( msg.Signature.Value, SigHash.All))
247247 let sigPairs = seq [ remoteSigPairOfLocalTx; ]
248248 Transactions.checkTxFinalized signedLocalCommitTx state.LocalCommitTx.WhichInput sigPairs |> expectTransactionError
249- let commitments = { Commitments.LocalParams = state.LocalParams
250- RemoteParams = state.RemoteParams
251- ChannelFlags = state.ChannelFlags
252- FundingScriptCoin =
253- let amount = state.FundingTx.Value.Outputs.[ int state.LastSent.FundingOutputIndex.Value]. Value
254- ChannelHelpers.getFundingScriptCoin
255- state.LocalParams.ChannelPubKeys.FundingPubKey
256- remoteChannelKeys.FundingPubKey
257- state.LastSent.FundingTxId
258- state.LastSent.FundingOutputIndex
259- amount
260- LocalCommit = { Index = CommitmentNumber.FirstCommitment;
261- Spec = state.LocalSpec;
262- PublishableTxs = { PublishableTxs.CommitTx = finalizedLocalCommitTx
263- HTLCTxs = [] }
264- PendingHTLCSuccessTxs = [] }
265- RemoteCommit = state.RemoteCommit
266- LocalChanges = LocalChanges.Zero
267- RemoteChanges = RemoteChanges.Zero
268- LocalNextHTLCId = HTLCId.Zero
269- RemoteNextHTLCId = HTLCId.Zero
270- OriginChannels = Map.empty
271- // we will receive their next per-commitment point in the next msg, so we temporarily put a random byte array
272- RemoteNextCommitInfo = DataEncoders.HexEncoder() .DecodeData( " 0101010101010101010101010101010101010101010101010101010101010101" ) |> fun h -> new Key( h) |> fun k -> k.PubKey |> PerCommitmentPoint |> RemoteNextCommitInfo.Revoked
273- RemotePerCommitmentSecrets = PerCommitmentSecretStore()
274- ChannelId =
275- msg.ChannelId }
249+ let commitments = {
250+ Commitments.LocalParams = state.LocalParams
251+ RemoteParams = state.RemoteParams
252+ ChannelFlags = state.ChannelFlags
253+ FundingScriptCoin =
254+ let amount = state.FundingTx.Value.Outputs.[ int state.LastSent.FundingOutputIndex.Value]. Value
255+ ChannelHelpers.getFundingScriptCoin
256+ state.LocalParams.ChannelPubKeys.FundingPubKey
257+ remoteChannelKeys.FundingPubKey
258+ state.LastSent.FundingTxId
259+ state.LastSent.FundingOutputIndex
260+ amount
261+ LocalCommit = {
262+ Index = CommitmentNumber.FirstCommitment
263+ Spec = state.LocalSpec
264+ PublishableTxs = {
265+ PublishableTxs.CommitTx = finalizedLocalCommitTx
266+ HTLCTxs = []
267+ }
268+ PendingHTLCSuccessTxs = []
269+ }
270+ RemoteCommit = state.RemoteCommit
271+ LocalChanges = LocalChanges.Zero
272+ RemoteChanges = RemoteChanges.Zero
273+ LocalNextHTLCId = HTLCId.Zero
274+ RemoteNextHTLCId = HTLCId.Zero
275+ OriginChannels = Map.empty
276+ // we will receive their next per-commitment point in the next msg, so we temporarily put a random byte array
277+ RemoteNextCommitInfo = DataEncoders.HexEncoder() .DecodeData( " 0101010101010101010101010101010101010101010101010101010101010101" ) |> fun h -> new Key( h) |> fun k -> k.PubKey |> PerCommitmentPoint |> RemoteNextCommitInfo.Revoked
278+ RemotePerCommitmentSecrets = PerCommitmentSecretStore()
279+ ChannelId = msg.ChannelId
280+ LocalSignaturesOfRemoteCommitments = [ state.LastSent.Signature ]
281+ }
276282 let nextState = { WaitForFundingConfirmedData.Commitments = commitments
277283 Deferred = None
278284 LastSent = Choice1Of2 state.LastSent
@@ -346,33 +352,42 @@ module Channel =
346352 cs.ChannelPrivKeys.SignWithFundingPrivKey remoteCommitTx.Value
347353 let channelId = OutPoint( msg.FundingTxId.Value, uint32 msg.FundingOutputIndex.Value). ToChannelId()
348354 let msgToSend : FundingSignedMsg = { ChannelId = channelId; Signature = !> localSigOfRemoteCommit.Signature }
349- let commitments = { Commitments.LocalParams = state.LocalParams
350- RemoteParams = state.RemoteParams
351- ChannelFlags = state.ChannelFlags
352- FundingScriptCoin =
353- ChannelHelpers.getFundingScriptCoin
354- state.LocalParams.ChannelPubKeys.FundingPubKey
355- remoteChannelKeys.FundingPubKey
356- msg.FundingTxId
357- msg.FundingOutputIndex
358- state.FundingSatoshis
359- LocalCommit = { LocalCommit.Index = CommitmentNumber.FirstCommitment
360- Spec = localSpec
361- PublishableTxs = { PublishableTxs.CommitTx = finalizedCommitTx;
362- HTLCTxs = [] }
363- PendingHTLCSuccessTxs = [] }
364- RemoteCommit = { RemoteCommit.Index = CommitmentNumber.FirstCommitment
365- Spec = remoteSpec
366- TxId = remoteCommitTx.Value.GetGlobalTransaction() .GetTxId()
367- RemotePerCommitmentPoint = state.RemoteFirstPerCommitmentPoint }
368- LocalChanges = LocalChanges.Zero
369- RemoteChanges = RemoteChanges.Zero
370- LocalNextHTLCId = HTLCId.Zero
371- RemoteNextHTLCId = HTLCId.Zero
372- OriginChannels = Map.empty
373- RemoteNextCommitInfo = DataEncoders.HexEncoder() .DecodeData( " 0101010101010101010101010101010101010101010101010101010101010101" ) |> fun h -> new Key( h) |> fun k -> k.PubKey |> PerCommitmentPoint |> RemoteNextCommitInfo.Revoked
374- RemotePerCommitmentSecrets = PerCommitmentSecretStore()
375- ChannelId = channelId }
355+ let commitments = {
356+ Commitments.LocalParams = state.LocalParams
357+ RemoteParams = state.RemoteParams
358+ ChannelFlags = state.ChannelFlags
359+ FundingScriptCoin =
360+ ChannelHelpers.getFundingScriptCoin
361+ state.LocalParams.ChannelPubKeys.FundingPubKey
362+ remoteChannelKeys.FundingPubKey
363+ msg.FundingTxId
364+ msg.FundingOutputIndex
365+ state.FundingSatoshis
366+ LocalCommit = {
367+ LocalCommit.Index = CommitmentNumber.FirstCommitment
368+ Spec = localSpec
369+ PublishableTxs = {
370+ PublishableTxs.CommitTx = finalizedCommitTx
371+ HTLCTxs = []
372+ }
373+ PendingHTLCSuccessTxs = []
374+ }
375+ RemoteCommit = {
376+ RemoteCommit.Index = CommitmentNumber.FirstCommitment
377+ Spec = remoteSpec
378+ TxId = remoteCommitTx.Value.GetGlobalTransaction() .GetTxId()
379+ RemotePerCommitmentPoint = state.RemoteFirstPerCommitmentPoint
380+ }
381+ LocalChanges = LocalChanges.Zero
382+ RemoteChanges = RemoteChanges.Zero
383+ LocalNextHTLCId = HTLCId.Zero
384+ RemoteNextHTLCId = HTLCId.Zero
385+ OriginChannels = Map.empty
386+ RemoteNextCommitInfo = DataEncoders.HexEncoder() .DecodeData( " 0101010101010101010101010101010101010101010101010101010101010101" ) |> fun h -> new Key( h) |> fun k -> k.PubKey |> PerCommitmentPoint |> RemoteNextCommitInfo.Revoked
387+ RemotePerCommitmentSecrets = PerCommitmentSecretStore()
388+ ChannelId = channelId
389+ LocalSignaturesOfRemoteCommitments = [ !> localSigOfRemoteCommit.Signature ]
390+ }
376391 let nextState = { WaitForFundingConfirmedData.Commitments = commitments
377392 Deferred = None
378393 LastSent = msgToSend |> Choice2Of2
0 commit comments