Skip to content

Commit

Permalink
Transactions: remove makeClaimP2WPKHOutputTx function
Browse files Browse the repository at this point in the history
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
  • Loading branch information
aarani authored and knocte committed Mar 22, 2022
1 parent d0de8a8 commit 5379324
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions src/DotNetLightning.Core/Transactions/Transactions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ClaimP2WPKHOutputTx, _> =
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)
Expand Down

0 comments on commit 5379324

Please sign in to comment.