sweep: remove unused param Fee

This commit is contained in:
yyforyongyu 2024-04-11 17:48:08 +08:00
parent 54aaeea491
commit 9c5124e117
No known key found for this signature in database
GPG Key ID: 9BCD95C4FF296868
3 changed files with 0 additions and 45 deletions

View File

@ -99,8 +99,6 @@ func (c *anchorResolver) Resolve(_ bool) (ContractResolver, error) {
// After a restart or when the remote force closes, the sweeper is not
// yet aware of the anchor. In that case, it will be added as new input
// to the sweeper.
relayFeeRate := c.Sweeper.RelayFeePerKW()
witnessType := input.CommitmentAnchor
// For taproot channels, we need to use the proper witness type.
@ -116,9 +114,6 @@ func (c *anchorResolver) Resolve(_ bool) (ContractResolver, error) {
resultChan, err := c.Sweeper.SweepInput(
&anchorInput,
sweep.Params{
Fee: sweep.FeeEstimateInfo{
FeeRate: relayFeeRate,
},
// For normal anchor sweeping, the budget is 330 sats.
Budget: btcutil.Amount(
anchorInput.SignDesc().Output.Value,

View File

@ -1,7 +1,6 @@
package contractcourt
import (
"fmt"
"testing"
"time"
@ -135,20 +134,6 @@ func (s *mockSweeper) SweepInput(input input.Input, params sweep.Params) (
s.sweptInputs <- input
// TODO(yy): replace mockSweeper with `mock.Mock`.
if params.Fee != nil {
fee, ok := params.Fee.(sweep.FeeEstimateInfo)
if !ok {
return nil, fmt.Errorf("unexpected fee type: %T",
params.Fee)
}
// Update the deadlines used if it's set.
if fee.ConfTarget != 0 {
s.deadlines = append(s.deadlines, int(fee.ConfTarget))
}
}
// Update the deadlines used if it's set.
params.DeadlineHeight.WhenSome(func(d int32) {
s.deadlines = append(s.deadlines, int(d))

View File

@ -43,11 +43,6 @@ var (
// Params contains the parameters that control the sweeping process.
type Params struct {
// Fee is the fee preference of the client who requested the input to be
// swept. If a confirmation target is specified, then we'll map it into
// a fee rate whenever we attempt to cluster inputs for a sweep.
Fee FeePreference
// ExclusiveGroup is an identifier that, if set, prevents other inputs
// with the same identifier from being batched together.
ExclusiveGroup *uint64
@ -211,13 +206,6 @@ func (p *SweeperInput) String() string {
return fmt.Sprintf("%v (%v)", p.Input.OutPoint(), p.Input.WitnessType())
}
// parameters returns the sweep parameters for this input.
//
// NOTE: Part of the txInput interface.
func (p *SweeperInput) parameters() Params {
return p.params
}
// terminated returns a boolean indicating whether the input has reached a
// final state.
func (p *SweeperInput) terminated() bool {
@ -512,18 +500,6 @@ func (s *UtxoSweeper) SweepInput(inp input.Input,
return nil, errors.New("nil input received")
}
// Ensure the client provided a sane fee preference.
//
// TODO(yy): remove this check?
if params.Fee != nil {
_, err := params.Fee.Estimate(
s.cfg.FeeEstimator, s.cfg.MaxFeeRate.FeePerKWeight(),
)
if err != nil {
return nil, err
}
}
absoluteTimeLock, _ := inp.RequiredLockTime()
log.Infof("Sweep request received: out_point=%v, witness_type=%v, "+
"relative_time_lock=%v, absolute_time_lock=%v, amount=%v, "+
@ -1145,7 +1121,6 @@ func (s *UtxoSweeper) handleUpdateReq(req *updateReq) (
// Create the updated parameters struct. Leave the exclusive group
// unchanged.
newParams := Params{
Fee: req.params.Fee,
StartingFeeRate: req.params.StartingFeeRate,
Immediate: req.params.Immediate,
Budget: req.params.Budget,