diff --git a/breacharbiter.go b/breacharbiter.go index 1771b81fa..0987e9b67 100644 --- a/breacharbiter.go +++ b/breacharbiter.go @@ -1050,13 +1050,13 @@ func (b *breachArbiter) createJusticeTx( spendableOutputs = append(spendableOutputs, input) } - txWeight := uint64(weightEstimate.Weight()) - return b.sweepSpendableOutputsTxn(txWeight, spendableOutputs...) + txVSize := int64(weightEstimate.VSize()) + return b.sweepSpendableOutputsTxn(txVSize, spendableOutputs...) } // sweepSpendableOutputsTxn creates a signed transaction from a sequence of // spendable outputs by sweeping the funds into a single p2wkh output. -func (b *breachArbiter) sweepSpendableOutputsTxn(txWeight uint64, +func (b *breachArbiter) sweepSpendableOutputsTxn(txVSize int64, inputs ...SpendableOutput) (*wire.MsgTx, error) { // First, we obtain a new public key script from the wallet which we'll @@ -1076,11 +1076,11 @@ func (b *breachArbiter) sweepSpendableOutputsTxn(txWeight uint64, // We'll actually attempt to target inclusion within the next two // blocks as we'd like to sweep these funds back into our wallet ASAP. - feePerWeight, err := b.cfg.Estimator.EstimateFeePerWeight(2) + feePerVSize, err := b.cfg.Estimator.EstimateFeePerVSize(2) if err != nil { return nil, err } - txFee := btcutil.Amount(txWeight * uint64(feePerWeight)) + txFee := feePerVSize.FeeForVSize(txVSize) // TODO(roasbeef): already start to siphon their funds into fees sweepAmt := int64(totalAmt - txFee)