From e20448ebc628a890031f2d5218d200a52b15ea74 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 23 Nov 2017 00:11:42 -0600 Subject: [PATCH] lnwallet: update StaticFeeEstimator to adhere to new FeeEstimator interface --- lnwallet/fee_estimator.go | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/lnwallet/fee_estimator.go b/lnwallet/fee_estimator.go index 459ce047..87c71f10 100644 --- a/lnwallet/fee_estimator.go +++ b/lnwallet/fee_estimator.go @@ -36,17 +36,37 @@ type StaticFeeEstimator struct { // FeeRate is the static fee rate in satoshis-per-byte that will be // returned by this fee estimator. Queries for the fee rate in weight // units will be scaled accordingly. - FeeRate uint64 + FeeRate btcutil.Amount } // EstimateFeePerByte will return a static value for fee calculations. -func (e StaticFeeEstimator) EstimateFeePerByte(numBlocks uint32) uint64 { - return e.FeeRate +// +// NOTE: This method is part of the FeeEstimator interface. +func (e StaticFeeEstimator) EstimateFeePerByte(numBlocks uint32) (btcutil.Amount, error) { + return e.FeeRate, nil } // EstimateFeePerWeight will return a static value for fee calculations. -func (e StaticFeeEstimator) EstimateFeePerWeight(numBlocks uint32) uint64 { - return e.FeeRate / 4 +// +// NOTE: This method is part of the FeeEstimator interface. +func (e StaticFeeEstimator) EstimateFeePerWeight(numBlocks uint32) (btcutil.Amount, error) { + return e.FeeRate / blockchain.WitnessScaleFactor, nil +} + +// Start signals the FeeEstimator to start any processes or goroutines +// it needs to perform its duty. +// +// NOTE: This method is part of the FeeEstimator interface. +func (e StaticFeeEstimator) Start() error { + return nil +} + +// Stop stops any spawned goroutines and cleans up the resources used +// by the fee estimator. +// +// NOTE: This method is part of the FeeEstimator interface. +func (e StaticFeeEstimator) Stop() error { + return nil } // A compile-time assertion to ensure that StaticFeeEstimator implements the