From fda35ef8c935645e65cafd7e60c1c87c2dba50e6 Mon Sep 17 00:00:00 2001 From: Andrew Cann Date: Tue, 14 Jul 2020 18:51:31 +0800 Subject: [PATCH] Use correct channel ID in WaitForFundingSigned This makes geewallet's OutgoingUnfundedChannel report the correct/true channel id, rather than the temporary channel id used during the initial stage of channel opening. This is commit 6f1175a5cdd0958be1a1f02039544a2ae840449c in upstream DNL. --- src/DotNetLightning.Core/Channel/Channel.fs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/DotNetLightning.Core/Channel/Channel.fs b/src/DotNetLightning.Core/Channel/Channel.fs index 7ce91b685..add949298 100644 --- a/src/DotNetLightning.Core/Channel/Channel.fs +++ b/src/DotNetLightning.Core/Channel/Channel.fs @@ -169,6 +169,7 @@ module Channel = assert (state.LastSent.FundingPubKey = localParams.ChannelPubKeys.FundingPubKey) let commitmentSpec = state.InputInitFunder.DeriveCommitmentSpec() let commitmentSeed = state.InputInitFunder.ChannelKeys.CommitmentSeed + let fundingTxId = fundingTx.Value.GetTxId() let! (_localSpec, localCommitTx, remoteSpec, remoteCommitTx) = ChannelHelpers.makeFirstCommitTxs localParams remoteParams @@ -176,7 +177,7 @@ module Channel = state.LastSent.PushMSat state.LastSent.FeeRatePerKw outIndex - (fundingTx.Value.GetHash() |> TxId) + fundingTxId (ChannelUtils.buildCommitmentPoint(commitmentSeed, 0UL)) msg.FirstPerCommitmentPoint cs.Secp256k1Context @@ -184,11 +185,12 @@ module Channel = let localSigOfRemoteCommit, _ = (cs.KeysRepository.GetSignatureFor(remoteCommitTx.Value, state.LastSent.FundingPubKey)) let nextMsg: FundingCreatedMsg = { TemporaryChannelId = msg.TemporaryChannelId - FundingTxId = fundingTx.Value.GetTxId() + FundingTxId = fundingTxId FundingOutputIndex = outIndex Signature = !>localSigOfRemoteCommit.Signature } - let data = { Data.WaitForFundingSignedData.ChannelId = msg.TemporaryChannelId + let channelId = OutPoint(fundingTxId.Value, uint32 outIndex.Value).ToChannelId() + let data = { Data.WaitForFundingSignedData.ChannelId = channelId LocalParams = localParams RemoteParams = remoteParams Data.WaitForFundingSignedData.FundingTx = fundingTx