breacharbiter: use EstimateFeePerVSize
This commit is contained in:
parent
e48d51db92
commit
d4cedc2917
@ -1050,13 +1050,13 @@ func (b *breachArbiter) createJusticeTx(
|
|||||||
spendableOutputs = append(spendableOutputs, input)
|
spendableOutputs = append(spendableOutputs, input)
|
||||||
}
|
}
|
||||||
|
|
||||||
txWeight := uint64(weightEstimate.Weight())
|
txVSize := int64(weightEstimate.VSize())
|
||||||
return b.sweepSpendableOutputsTxn(txWeight, spendableOutputs...)
|
return b.sweepSpendableOutputsTxn(txVSize, spendableOutputs...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// sweepSpendableOutputsTxn creates a signed transaction from a sequence of
|
// sweepSpendableOutputsTxn creates a signed transaction from a sequence of
|
||||||
// spendable outputs by sweeping the funds into a single p2wkh output.
|
// 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) {
|
inputs ...SpendableOutput) (*wire.MsgTx, error) {
|
||||||
|
|
||||||
// First, we obtain a new public key script from the wallet which we'll
|
// 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
|
// 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.
|
// 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 {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
txFee := btcutil.Amount(txWeight * uint64(feePerWeight))
|
txFee := feePerVSize.FeeForVSize(txVSize)
|
||||||
|
|
||||||
// TODO(roasbeef): already start to siphon their funds into fees
|
// TODO(roasbeef): already start to siphon their funds into fees
|
||||||
sweepAmt := int64(totalAmt - txFee)
|
sweepAmt := int64(totalAmt - txFee)
|
||||||
|
Loading…
Reference in New Issue
Block a user