multi: apply the new type lntypes.WeightUnit
This commit is contained in:
36 files changed
+178
-133
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
)
|
||||
|
||||
@@ -15,7 +16,7 @@ type weightEstimator struct {
|
||||
feeRate chainfee.SatPerKWeight
|
||||
parents map[chainhash.Hash]struct{}
|
||||
parentsFee btcutil.Amount
|
||||
parentsWeight int64
|
||||
parentsWeight lntypes.WeightUnit
|
||||
|
||||
// maxFeeRate is the max allowed fee rate configured by the user.
|
||||
maxFeeRate chainfee.SatPerKWeight
|
||||
@@ -102,7 +103,7 @@ func (w *weightEstimator) addOutput(txOut *wire.TxOut) {
|
||||
}
|
||||
|
||||
// weight gets the estimated weight of the transaction.
|
||||
func (w *weightEstimator) weight() int {
|
||||
func (w *weightEstimator) weight() lntypes.WeightUnit {
|
||||
return w.estimator.Weight()
|
||||
}
|
||||
|
||||
@@ -111,7 +112,7 @@ func (w *weightEstimator) weight() int {
|
||||
// parent transactions.
|
||||
func (w *weightEstimator) fee() btcutil.Amount {
|
||||
// Calculate the weight of the transaction.
|
||||
weight := int64(w.estimator.Weight())
|
||||
weight := w.estimator.Weight()
|
||||
|
||||
// Calculate the fee.
|
||||
fee := w.feeRate.FeeForWeight(weight)
|
||||
@@ -123,7 +124,7 @@ func (w *weightEstimator) fee() btcutil.Amount {
|
||||
// outputs, taking into account unconfirmed parent transactions (cpfp).
|
||||
func (w *weightEstimator) feeWithParent() btcutil.Amount {
|
||||
// Calculate fee and weight for just this tx.
|
||||
childWeight := int64(w.estimator.Weight())
|
||||
childWeight := w.estimator.Weight()
|
||||
|
||||
// Add combined weight of unconfirmed parent txes.
|
||||
totalWeight := childWeight + w.parentsWeight
|
||||
|
||||
Reference in new issue
Block a user