From 5379324db7e76f9d2212d96c2729c9f72b5aa900 Mon Sep 17 00:00:00 2001 From: Afshin Arani Date: Wed, 2 Mar 2022 14:15:19 +0330 Subject: [PATCH] Transactions: remove makeClaimP2WPKHOutputTx function This function is a duplicate of tryGetFundsFromRemoteCommitmentTx. In anchor channels, to_remote output is no longer a simple P2WKH, instead it's a P2WSH with a one block csv lock. More info: https://github.com/lightning/bolts/blob/master/03-transactions.md#to_remote-output Upstream PR: https://github.com/joemphilips/DotNetLightning/pull/181 --- .../Transactions/Transactions.fs | 32 ------------------- 1 file changed, 32 deletions(-) diff --git a/src/DotNetLightning.Core/Transactions/Transactions.fs b/src/DotNetLightning.Core/Transactions/Transactions.fs index 395f7fd59..36578f418 100644 --- a/src/DotNetLightning.Core/Transactions/Transactions.fs +++ b/src/DotNetLightning.Core/Transactions/Transactions.fs @@ -739,38 +739,6 @@ module Transactions = .AddCoins(coin) psbt |> ClaimHTLCTimeoutTx |> Ok - let makeClaimP2WPKHOutputTx (delayedOutputTx: Transaction) - (localDustLimit: Money) - (localPaymentPubKey: PaymentPubKey) - (localFinalDestination: IDestination) - (feeRatePerKw: FeeRatePerKw) - (network: Network) - : Result = - let fee = feeRatePerKw.CalculateFeeFromWeight(CLAIM_P2WPKH_OUTPUT_WEIGHT) - let spk = localPaymentPubKey.RawPubKey().WitHash.ScriptPubKey - let spkIndex = findScriptPubKeyIndex delayedOutputTx spk - let outPut = delayedOutputTx.Outputs.AsIndexedOutputs().ElementAt(spkIndex) - let amount = (outPut).TxOut.Value - fee - if (amount < localDustLimit) then - AmountBelowDustLimit amount |> Error - else - let psbt = - let coin = Coin(outPut) - let txb = createDeterministicTransactionBuilder network - // we have already done dust limit check above - txb.DustPrevention <- false - let tx = txb - .AddCoins(coin) - .Send(localFinalDestination, amount) - .SendFees(fee) - .SetLockTime(!> 0u) - .BuildTransaction(false) - tx.Version <- 2u - tx.Inputs.[0].Sequence <- !> UINT32_MAX - PSBT.FromTransaction(tx, network) - .AddCoins(coin) - psbt |> ClaimP2WPKHOutputTx|> Ok - let makeMainPenaltyTx (commitTx: Transaction) (localDustLimit: Money) (remoteRevocationKey: RevocationPubKey)