funding+utxonursery+breacharbiter: use new FeeEstimator API

This commit is contained in:
Olaoluwa Osuntokun committed 2017-11-23 23:10:13 -06:00
1 parent ad364ae9a1
commit a3cd248404
4 files changed
+32 -20

No files matched your search

+8 -5
View File
@@ -877,15 +877,18 @@ func (u *utxoNursery) sweepCsvSpendableOutputsTxn(txWeight uint64,
}
// Using the txn weight estimate, compute the required txn fee.
feePerWeight := u.cfg.Estimator.EstimateFeePerWeight(1)
txFee := btcutil.Amount(txWeight * feePerWeight)
feePerWeight, err := u.cfg.Estimator.EstimateFeePerWeight(6)
if err != nil {
return nil, err
}
txFee := btcutil.Amount(txWeight) * feePerWeight
// Sweep as much possible, after subtracting txn fees.
sweepAmt := int64(totalSum - txFee)
// Create the sweep transaction that we will be building. We use version
// 2 as it is required for CSV. The txn will sweep the amount after fees
// to the pkscript generated above.
// Create the sweep transaction that we will be building. We use
// version 2 as it is required for CSV. The txn will sweep the amount
// after fees to the pkscript generated above.
sweepTx := wire.NewMsgTx(2)
sweepTx.AddTxOut(&wire.TxOut{
PkScript: pkScript,