sweep: rename Estimator to FeeEstimator

This commit is contained in:
Olaoluwa Osuntokun 2018-11-17 20:57:30 -08:00
parent a0c0e8edc9
commit 77262ff699
3 changed files with 9 additions and 9 deletions

@ -607,7 +607,7 @@ func newServer(listenAddrs []net.Addr, chanDB *channeldb.DB, cc *chainControl,
} }
s.sweeper = sweep.New(&sweep.UtxoSweeperConfig{ s.sweeper = sweep.New(&sweep.UtxoSweeperConfig{
Estimator: cc.feeEstimator, FeeEstimator: cc.feeEstimator,
GenSweepScript: func() ([]byte, error) { GenSweepScript: func() ([]byte, error) {
return newSweepPkScript(cc.wallet) return newSweepPkScript(cc.wallet)
}, },

@ -85,10 +85,10 @@ type UtxoSweeperConfig struct {
// funds can be swept. // funds can be swept.
GenSweepScript func() ([]byte, error) GenSweepScript func() ([]byte, error)
// Estimator is used when crafting sweep transactions to estimate the // FeeEstimator is used when crafting sweep transactions to estimate
// necessary fee relative to the expected size of the sweep // the necessary fee relative to the expected size of the sweep
// transaction. // transaction.
Estimator lnwallet.FeeEstimator FeeEstimator lnwallet.FeeEstimator
// PublishTransaction facilitates the process of broadcasting a signed // PublishTransaction facilitates the process of broadcasting a signed
// transaction to the appropriate network. // transaction to the appropriate network.
@ -198,7 +198,7 @@ func (s *UtxoSweeper) Start() error {
// Retrieve relay fee for dust limit calculation. Assume that this will // Retrieve relay fee for dust limit calculation. Assume that this will
// not change from here on. // not change from here on.
s.relayFeePerKW = s.cfg.Estimator.RelayFeePerKW() s.relayFeePerKW = s.cfg.FeeEstimator.RelayFeePerKW()
// Register for block epochs to retry sweeping every block. // Register for block epochs to retry sweeping every block.
bestHash, bestHeight, err := s.cfg.ChainIO.GetBestBlock() bestHash, bestHeight, err := s.cfg.ChainIO.GetBestBlock()
@ -407,7 +407,7 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch,
// Retrieve fee estimate for input filtering and final // Retrieve fee estimate for input filtering and final
// tx fee calculation. // tx fee calculation.
satPerKW, err := s.cfg.Estimator.EstimateFeePerKW( satPerKW, err := s.cfg.FeeEstimator.EstimateFeePerKW(
s.cfg.SweepTxConfTarget, s.cfg.SweepTxConfTarget,
) )
if err != nil { if err != nil {
@ -465,7 +465,7 @@ func (s *UtxoSweeper) scheduleSweep(currentHeight int32) error {
// Retrieve fee estimate for input filtering and final tx fee // Retrieve fee estimate for input filtering and final tx fee
// calculation. // calculation.
satPerKW, err := s.cfg.Estimator.EstimateFeePerKW( satPerKW, err := s.cfg.FeeEstimator.EstimateFeePerKW(
s.cfg.SweepTxConfTarget, s.cfg.SweepTxConfTarget,
) )
if err != nil { if err != nil {
@ -753,7 +753,7 @@ func (s *UtxoSweeper) waitForSpend(outpoint wire.OutPoint,
func (s *UtxoSweeper) CreateSweepTx(inputs []Input, confTarget uint32, func (s *UtxoSweeper) CreateSweepTx(inputs []Input, confTarget uint32,
currentBlockHeight uint32) (*wire.MsgTx, error) { currentBlockHeight uint32) (*wire.MsgTx, error) {
feePerKw, err := s.cfg.Estimator.EstimateFeePerKW(confTarget) feePerKw, err := s.cfg.FeeEstimator.EstimateFeePerKW(confTarget)
if err != nil { if err != nil {
return nil, err return nil, err
} }

@ -135,7 +135,7 @@ func createSweeperTestContext(t *testing.T) *sweeperTestContext {
outputScriptCount++ outputScriptCount++
return script, nil return script, nil
}, },
Estimator: estimator, FeeEstimator: estimator,
MaxInputsPerTx: testMaxInputsPerTx, MaxInputsPerTx: testMaxInputsPerTx,
MaxSweepAttempts: testMaxSweepAttempts, MaxSweepAttempts: testMaxSweepAttempts,
NextAttemptDeltaFunc: func(attempts int) int32 { NextAttemptDeltaFunc: func(attempts int) int32 {