multi: apply the new type lntypes.WeightUnit
This commit is contained in:
36 files changed
+178
-133
No files matched your search
+12
-10
@@ -28,6 +28,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb/models"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lntypes"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
|
||||
"github.com/lightningnetwork/lnd/lnwire"
|
||||
"github.com/lightningnetwork/lnd/shachain"
|
||||
@@ -3800,7 +3801,7 @@ func (lc *LightningChannel) getUnsignedAckedUpdates() []channeldb.LogUpdate {
|
||||
// an htlc even if our channel is drained locally.
|
||||
// See: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md
|
||||
func CalcFeeBuffer(feePerKw chainfee.SatPerKWeight,
|
||||
commitWeight int64) lnwire.MilliSatoshi {
|
||||
commitWeight lntypes.WeightUnit) lnwire.MilliSatoshi {
|
||||
|
||||
// Account for a 100% in fee rate increase.
|
||||
bufferFeePerKw := 2 * feePerKw
|
||||
@@ -3873,7 +3874,7 @@ func (b BufferType) String() string {
|
||||
// and verifies that it does not become negative. This function returns the new
|
||||
// balance and the exact buffer amount (excluding the commitment fee).
|
||||
func (lc *LightningChannel) applyCommitFee(
|
||||
balance lnwire.MilliSatoshi, commitWeight int64,
|
||||
balance lnwire.MilliSatoshi, commitWeight lntypes.WeightUnit,
|
||||
feePerKw chainfee.SatPerKWeight,
|
||||
buffer BufferType) (lnwire.MilliSatoshi, lnwire.MilliSatoshi, error) {
|
||||
|
||||
@@ -4730,8 +4731,8 @@ func (lc *LightningChannel) ProcessChanSyncMsg(
|
||||
// If the updateState boolean is set true, the add and remove heights of the
|
||||
// HTLCs will be set to the next commitment height.
|
||||
func (lc *LightningChannel) computeView(view *htlcView, remoteChain bool,
|
||||
updateState bool) (lnwire.MilliSatoshi, lnwire.MilliSatoshi, int64,
|
||||
*htlcView, error) {
|
||||
updateState bool) (lnwire.MilliSatoshi, lnwire.MilliSatoshi,
|
||||
lntypes.WeightUnit, *htlcView, error) {
|
||||
|
||||
commitChain := lc.localCommitChain
|
||||
dustLimit := lc.channelState.LocalChanCfg.DustLimit
|
||||
@@ -4792,7 +4793,7 @@ func (lc *LightningChannel) computeView(view *htlcView, remoteChain bool,
|
||||
|
||||
// Now go through all HTLCs at this stage, to calculate the total
|
||||
// weight, needed to calculate the transaction fee.
|
||||
var totalHtlcWeight int64
|
||||
var totalHtlcWeight lntypes.WeightUnit
|
||||
for _, htlc := range filteredHTLCView.ourUpdates {
|
||||
if HtlcIsDust(
|
||||
lc.channelState.ChanType, false, !remoteChain,
|
||||
@@ -7522,7 +7523,7 @@ type AnchorResolution struct {
|
||||
CommitFee btcutil.Amount
|
||||
|
||||
// CommitWeight is the weight of the commit tx.
|
||||
CommitWeight int64
|
||||
CommitWeight lntypes.WeightUnit
|
||||
}
|
||||
|
||||
// LocalForceCloseSummary describes the final commitment state before the
|
||||
@@ -8200,7 +8201,7 @@ func NewAnchorResolution(chanState *channeldb.OpenChannel,
|
||||
return &AnchorResolution{
|
||||
CommitAnchor: *outPoint,
|
||||
AnchorSignDescriptor: *signDesc,
|
||||
CommitWeight: weight,
|
||||
CommitWeight: lntypes.WeightUnit(weight),
|
||||
CommitFee: fee,
|
||||
}, nil
|
||||
}
|
||||
@@ -8226,7 +8227,7 @@ func (lc *LightningChannel) AvailableBalance() lnwire.MilliSatoshi {
|
||||
// this method. Additionally, the total weight of the next to be created
|
||||
// commitment is returned for accounting purposes.
|
||||
func (lc *LightningChannel) availableBalance(
|
||||
buffer BufferType) (lnwire.MilliSatoshi, int64) {
|
||||
buffer BufferType) (lnwire.MilliSatoshi, lntypes.WeightUnit) {
|
||||
|
||||
// We'll grab the current set of log updates that the remote has
|
||||
// ACKed.
|
||||
@@ -8265,8 +8266,9 @@ func (lc *LightningChannel) availableBalance(
|
||||
// commitment, increasing the commitment fee we must pay as an initiator,
|
||||
// eating into our balance. It will make sure we won't violate the channel
|
||||
// reserve constraints for this amount.
|
||||
func (lc *LightningChannel) availableCommitmentBalance(view *htlcView,
|
||||
remoteChain bool, buffer BufferType) (lnwire.MilliSatoshi, int64) {
|
||||
func (lc *LightningChannel) availableCommitmentBalance(
|
||||
view *htlcView, remoteChain bool,
|
||||
buffer BufferType) (lnwire.MilliSatoshi, lntypes.WeightUnit) {
|
||||
|
||||
// Compute the current balances for this commitment. This will take
|
||||
// into account HTLCs to determine the commit weight, which the
|
||||
|
||||
Reference in new issue
Block a user