Skip to content

Commit 5379324

Browse files
aaraniknocte
authored andcommitted
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: joemphilips#181
1 parent d0de8a8 commit 5379324

File tree

1 file changed

+0
-32
lines changed

1 file changed

+0
-32
lines changed

src/DotNetLightning.Core/Transactions/Transactions.fs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -739,38 +739,6 @@ module Transactions =
739739
.AddCoins(coin)
740740
psbt |> ClaimHTLCTimeoutTx |> Ok
741741

742-
let makeClaimP2WPKHOutputTx (delayedOutputTx: Transaction)
743-
(localDustLimit: Money)
744-
(localPaymentPubKey: PaymentPubKey)
745-
(localFinalDestination: IDestination)
746-
(feeRatePerKw: FeeRatePerKw)
747-
(network: Network)
748-
: Result<ClaimP2WPKHOutputTx, _> =
749-
let fee = feeRatePerKw.CalculateFeeFromWeight(CLAIM_P2WPKH_OUTPUT_WEIGHT)
750-
let spk = localPaymentPubKey.RawPubKey().WitHash.ScriptPubKey
751-
let spkIndex = findScriptPubKeyIndex delayedOutputTx spk
752-
let outPut = delayedOutputTx.Outputs.AsIndexedOutputs().ElementAt(spkIndex)
753-
let amount = (outPut).TxOut.Value - fee
754-
if (amount < localDustLimit) then
755-
AmountBelowDustLimit amount |> Error
756-
else
757-
let psbt =
758-
let coin = Coin(outPut)
759-
let txb = createDeterministicTransactionBuilder network
760-
// we have already done dust limit check above
761-
txb.DustPrevention <- false
762-
let tx = txb
763-
.AddCoins(coin)
764-
.Send(localFinalDestination, amount)
765-
.SendFees(fee)
766-
.SetLockTime(!> 0u)
767-
.BuildTransaction(false)
768-
tx.Version <- 2u
769-
tx.Inputs.[0].Sequence <- !> UINT32_MAX
770-
PSBT.FromTransaction(tx, network)
771-
.AddCoins(coin)
772-
psbt |> ClaimP2WPKHOutputTx|> Ok
773-
774742
let makeMainPenaltyTx (commitTx: Transaction)
775743
(localDustLimit: Money)
776744
(remoteRevocationKey: RevocationPubKey)

0 commit comments

Comments
 (0)