Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/DotNetLightning.Core/Transactions/Transactions.fs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ module Transactions =
let txb = network.CreateTransactionBuilder()
txb.ShuffleOutputs <- false
txb.ShuffleInputs <- false
txb.OptInRBF <- true
txb

let UINT32_MAX = 0xffffffffu
Expand Down Expand Up @@ -412,6 +413,8 @@ module Transactions =
@ htlcReceivedOutputsWithMetadata
tx.Outputs.AddRange(txOuts |> sortTxOut)
tx.LockTime <- lockTime
if not tx.RBF then
failwith "Assertion failed: LN transactions should always be marked as RBF"
tx
let psbt =
let p = PSBT.FromTransaction(tx, network)
Expand Down Expand Up @@ -533,6 +536,9 @@ module Transactions =
for i in tx.Inputs do
i.Sequence <- Sequence(0)

if not tx.RBF then
failwith "Assertion failed: LN transactions should always be marked as RBF"

PSBT.FromTransaction(tx, network)
.AddCoins scriptCoin
let whichInput = psbt.Inputs |> Seq.findIndex(fun i -> not (isNull i.WitnessScript))
Expand Down Expand Up @@ -576,6 +582,9 @@ module Transactions =
for i in tx.Inputs do
i.Sequence <- Sequence(0)

if not tx.RBF then
failwith "Assertion failed: LN transactions should always be marked as RBF"

PSBT.FromTransaction(tx, network)
.AddCoins scriptCoin
let whichInput = psbt.Inputs |> Seq.findIndex(fun i -> not (isNull i.WitnessScript))
Expand Down Expand Up @@ -648,6 +657,8 @@ module Transactions =
.BuildTransaction(false)
tx.Version <- 2u
tx.Inputs.[0].Sequence <- !> UINT32_MAX
if not tx.RBF then
failwith "Assertion failed: LN transactions should always be marked as RBF"
PSBT.FromTransaction(tx, network)
.AddCoins(coin)
psbt |> ClaimHTLCSuccessTx |> Ok
Expand Down Expand Up @@ -680,6 +691,8 @@ module Transactions =
.BuildTransaction(false)
tx.Version <- 2u
tx.Inputs.[0].Sequence <- !> UINT32_MAX
if not tx.RBF then
failwith "Assertion failed: LN transactions should always be marked as RBF"
PSBT.FromTransaction(tx, network)
.AddCoins(coin)
psbt |> ClaimHTLCTimeoutTx |> Ok
Expand Down Expand Up @@ -712,6 +725,8 @@ module Transactions =
.BuildTransaction(false)
tx.Version <- 2u
tx.Inputs.[0].Sequence <- !> UINT32_MAX
if not tx.RBF then
failwith "Assertion failed: LN transactions should always be marked as RBF"
PSBT.FromTransaction(tx, network)
.AddCoins(coin)
psbt |> ClaimP2WPKHOutputTx|> Ok
Expand Down Expand Up @@ -747,6 +762,8 @@ module Transactions =
.BuildTransaction(false)
tx.Version <- 2u
tx.Inputs.[0].Sequence <- !> UINT32_MAX
if not tx.RBF then
failwith "Assertion failed: LN transactions should always be marked as RBF"
PSBT.FromTransaction(tx, network)
.AddCoins(coin)
psbt |> MainPenaltyTx |> Ok
Expand Down Expand Up @@ -790,6 +807,8 @@ module Transactions =
let tx = txb.BuildTransaction(false)
tx.Version <- 2u
tx.Inputs.[0].Sequence <- !> UINT32_MAX
if not tx.RBF then
failwith "Assertion failed: LN transactions should always be marked as RBF"
PSBT.FromTransaction(tx, network)
.AddCoins(commitTxInput)
psbt |> ClosingTx |> Ok
Expand Down