contractcourt: use vsize fee estimate and new fee rate types
This commit is contained in:
parent
4d2a36dce8
commit
166637bb55
@ -482,23 +482,24 @@ func (h *htlcSuccessResolver) Resolve() (ContractResolver, error) {
|
||||
//
|
||||
// TODO(roasbeef): signal up if fee would be too large
|
||||
// to sweep singly, need to batch
|
||||
satWeight, err := h.FeeEstimator.EstimateFeePerWeight(6)
|
||||
feePerVSize, err := h.FeeEstimator.EstimateFeePerVSize(6)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Debugf("%T(%x): using %v sat/weight to sweep htlc"+
|
||||
log.Debugf("%T(%x): using %v sat/vbyte to sweep htlc"+
|
||||
"incoming+remote htlc confirmed", h,
|
||||
h.payHash[:], int64(satWeight))
|
||||
h.payHash[:], int64(feePerVSize))
|
||||
|
||||
// Using a weight estimator, we'll compute the total
|
||||
// fee required, and from that the value we'll end up
|
||||
// with.
|
||||
totalWeight := (&lnwallet.TxWeightEstimator{}).
|
||||
totalVSize := (&lnwallet.TxWeightEstimator{}).
|
||||
AddWitnessInput(lnwallet.OfferedHtlcSuccessWitnessSize).
|
||||
AddP2WKHOutput().Weight()
|
||||
totalFees := int64(totalWeight) * int64(satWeight)
|
||||
sweepAmt := h.htlcResolution.SweepSignDesc.Output.Value - totalFees
|
||||
AddP2WKHOutput().VSize()
|
||||
totalFees := feePerVSize.FeeForVSize(int64(totalVSize))
|
||||
sweepAmt := h.htlcResolution.SweepSignDesc.Output.Value -
|
||||
int64(totalFees)
|
||||
|
||||
// With the fee computation finished, we'll now
|
||||
// construct the sweep transaction.
|
||||
@ -1252,19 +1253,19 @@ func (c *commitSweepResolver) Resolve() (ContractResolver, error) {
|
||||
// First, we'll estimate the total weight so we can compute
|
||||
// fees properly. We'll use a lax estimate, as this output is
|
||||
// in no immediate danger.
|
||||
satWeight, err := c.FeeEstimator.EstimateFeePerWeight(6)
|
||||
feePerVSize, err := c.FeeEstimator.EstimateFeePerVSize(6)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
log.Debugf("%T(%v): using %v sat/weight for sweep tx", c,
|
||||
c.chanPoint, int64(satWeight))
|
||||
log.Debugf("%T(%v): using %v sat/vsize for sweep tx", c,
|
||||
c.chanPoint, int64(feePerVSize))
|
||||
|
||||
totalWeight := (&lnwallet.TxWeightEstimator{}).
|
||||
totalVSize := (&lnwallet.TxWeightEstimator{}).
|
||||
AddP2PKHInput().
|
||||
AddP2WKHOutput().Weight()
|
||||
totalFees := int64(totalWeight) * int64(satWeight)
|
||||
sweepAmt := signDesc.Output.Value - totalFees
|
||||
AddP2WKHOutput().VSize()
|
||||
totalFees := feePerVSize.FeeForVSize(int64(totalVSize))
|
||||
sweepAmt := signDesc.Output.Value - int64(totalFees)
|
||||
|
||||
c.sweepTx = wire.NewMsgTx(2)
|
||||
c.sweepTx.AddTxIn(&wire.TxIn{
|
||||
|
Loading…
Reference in New Issue
Block a user