multi: apply the new type lntypes.WeightUnit

This commit is contained in:
yyforyongyu
2024-05-24 21:56:30 +08:00
parent dc9a0b31c0
commit 8da68bb7db
36 changed files with 178 additions and 133 deletions

View File

@@ -1737,7 +1737,7 @@ func (w *WalletKit) fundPsbtCoinSelect(account string, changeIndex int32,
// Do we already have enough inputs specified to pay for the TX as it
// is? In that case we only need to allocate any change, if there is
// any.
packetFeeNoChange := feeRate.FeeForWeight(int64(estimator.Weight()))
packetFeeNoChange := feeRate.FeeForWeight(estimator.Weight())
if inputSum >= outputSum+packetFeeNoChange {
// Calculate the packet's fee with a change output so, so we can
// let the coin selection algorithm decide whether to use a
@@ -1749,9 +1749,7 @@ func (w *WalletKit) fundPsbtCoinSelect(account string, changeIndex int32,
case chanfunding.P2WKHChangeAddress:
estimator.AddP2WKHOutput()
}
packetFeeWithChange := feeRate.FeeForWeight(
int64(estimator.Weight()),
)
packetFeeWithChange := feeRate.FeeForWeight(estimator.Weight())
changeAmt, needMore, err := chanfunding.CalculateChangeAmount(
inputSum, outputSum, packetFeeNoChange,

View File

@@ -132,7 +132,7 @@ func TestFundPsbtCoinSelect(t *testing.T) {
}
weight := estimator.Weight()
fee := chainfee.FeePerKwFloor.FeeForWeight(int64(weight))
fee := chainfee.FeePerKwFloor.FeeForWeight(weight)
return fee + dust
}