From 0713c8c7ce4ff4e58b6b9973ebc4234dc899d6d1 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Thu, 23 Nov 2017 00:11:02 -0600 Subject: [PATCH] lnwallet: extend FeeEstimator methods to be able to return an error In this commit, we extend the FeeEstimator methods to allow them to return an error. This is required as most implementations aside from the static fee estimator will want to be able to return errors to users to indicate the inability to properly estimate fees. --- lnwallet/fee_estimator.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lnwallet/fee_estimator.go b/lnwallet/fee_estimator.go index b75d5b804..1c739b553 100644 --- a/lnwallet/fee_estimator.go +++ b/lnwallet/fee_estimator.go @@ -1,5 +1,9 @@ package lnwallet +import ( + "github.com/roasbeef/btcutil" +) + // FeeEstimator provides the ability to estimate on-chain transaction fees for // various combinations of transaction sizes and desired confirmation time // (measured by number of blocks). @@ -7,12 +11,12 @@ type FeeEstimator interface { // EstimateFeePerByte takes in a target for the number of blocks until // an initial confirmation and returns the estimated fee expressed in // satoshis/byte. - EstimateFeePerByte(numBlocks uint32) uint64 + EstimateFeePerByte(numBlocks uint32) (btcutil.Amount, error) // EstimateFeePerWeight takes in a target for the number of blocks // until an initial confirmation and returns the estimated fee // expressed in satoshis/weight. - EstimateFeePerWeight(numBlocks uint32) uint64 + EstimateFeePerWeight(numBlocks uint32) (btcutil.Amount, error) } // StaticFeeEstimator will return a static value for all fee calculation