lnwallet: export HtlcWeight and CommitWeight publicly
This commit is contained in:
parent
b1a6b877ce
commit
145cd0b2b6
@ -1972,7 +1972,7 @@ func (lc *LightningChannel) createCommitmentTx(c *commitment,
|
||||
// on its total weight. Once we have the total weight, we'll multiply
|
||||
// by the current fee-per-kw, then divide by 1000 to get the proper
|
||||
// fee.
|
||||
totalCommitWeight := commitWeight + (htlcWeight * numHTLCs)
|
||||
totalCommitWeight := CommitWeight + (HtlcWeight * numHTLCs)
|
||||
|
||||
// With the weight known, we can now calculate the commitment fee,
|
||||
// ensuring that we account for any dust outputs trimmed above.
|
||||
|
@ -144,7 +144,7 @@ func NewChannelReservation(capacity, fundingAmt, feePerKw btcutil.Amount,
|
||||
initiator bool
|
||||
)
|
||||
|
||||
commitFee := btcutil.Amount((int64(feePerKw) * commitWeight) / 1000)
|
||||
commitFee := btcutil.Amount((int64(feePerKw) * CommitWeight) / 1000)
|
||||
|
||||
fundingMSat := lnwire.NewMSatFromSatoshis(fundingAmt)
|
||||
capacityMSat := lnwire.NewMSatFromSatoshis(capacity)
|
||||
|
@ -5,6 +5,15 @@ import (
|
||||
"github.com/roasbeef/btcd/wire"
|
||||
)
|
||||
|
||||
const (
|
||||
// CommitWeight is the weight of the base commitment transaction which
|
||||
// includes: one p2wsh input, out p2wkh output, and one p2wsh output.
|
||||
CommitWeight int64 = 724
|
||||
|
||||
// HtlcWeight is the weight of an HTLC output.
|
||||
HtlcWeight int64 = 172
|
||||
)
|
||||
|
||||
const (
|
||||
// witnessScaleFactor determines the level of "discount" witness data
|
||||
// receives compared to "base" data. A scale factor of 4, denotes that
|
||||
|
@ -39,9 +39,6 @@ const (
|
||||
// TODO(roasbeef): should instead be child to make room for future
|
||||
// rotations, etc.
|
||||
identityKeyIndex = hdkeychain.HardenedKeyStart + 2
|
||||
|
||||
commitWeight int64 = 724
|
||||
htlcWeight int64 = 172
|
||||
)
|
||||
|
||||
var (
|
||||
|
Loading…
Reference in New Issue
Block a user