Skip to content

Commit

Permalink
add param to digestInputs (fixup respect reserves in funding commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
chappjc committed Feb 14, 2023
1 parent e83807f commit fd53f71
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions client/asset/dcr/dcr.go
Expand Up @@ -1427,7 +1427,7 @@ func (dcr *ExchangeWallet) estimateSwap(lots, lotSize, feeSuggestion, maxFeeRate
avail := sumUTXOs(utxos)
reserves := dcr.reserves()

digestInputs := func() (reqFunds, maxFees, estHighFees, estLowFees uint64) {
digestInputs := func(inputsSize uint32) (reqFunds, maxFees, estHighFees, estLowFees uint64) {
// NOTE: reqFunds = val + fees, so change (extra) will be sum-reqFunds
reqFunds = calc.RequiredOrderFundsAlt(val, uint64(inputsSize), lots,
dexdcr.InitTxSizeBase, dexdcr.InitTxSize, bumpedMaxRate) // as in tryFund's enough func
Expand All @@ -1444,7 +1444,7 @@ func (dcr *ExchangeWallet) estimateSwap(lots, lotSize, feeSuggestion, maxFeeRate
return
}

reqFunds, maxFees, estHighFees, estLowFees := digestInputs()
reqFunds, maxFees, estHighFees, estLowFees := digestInputs(inputsSize)

// Math for split transactions is a little different.
if trySplit {
Expand Down Expand Up @@ -1476,7 +1476,7 @@ func (dcr *ExchangeWallet) estimateSwap(lots, lotSize, feeSuggestion, maxFeeRate
if err != nil { // no joy with the reduced set
return nil, false, 0, err
}
_, maxFees, estHighFees, estLowFees = digestInputs()
_, maxFees, estHighFees, estLowFees = digestInputs(inputsSize)
}

// No split transaction.
Expand Down

0 comments on commit fd53f71

Please sign in to comment.