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.
This commit is contained in:
Olaoluwa Osuntokun
2017-11-23 00:11:02 -06:00
parent 9b1f21e283
commit 0713c8c7ce

View File

@@ -1,5 +1,9 @@
package lnwallet package lnwallet
import (
"github.com/roasbeef/btcutil"
)
// FeeEstimator provides the ability to estimate on-chain transaction fees for // FeeEstimator provides the ability to estimate on-chain transaction fees for
// various combinations of transaction sizes and desired confirmation time // various combinations of transaction sizes and desired confirmation time
// (measured by number of blocks). // (measured by number of blocks).
@@ -7,12 +11,12 @@ type FeeEstimator interface {
// EstimateFeePerByte takes in a target for the number of blocks until // EstimateFeePerByte takes in a target for the number of blocks until
// an initial confirmation and returns the estimated fee expressed in // an initial confirmation and returns the estimated fee expressed in
// satoshis/byte. // satoshis/byte.
EstimateFeePerByte(numBlocks uint32) uint64 EstimateFeePerByte(numBlocks uint32) (btcutil.Amount, error)
// EstimateFeePerWeight takes in a target for the number of blocks // EstimateFeePerWeight takes in a target for the number of blocks
// until an initial confirmation and returns the estimated fee // until an initial confirmation and returns the estimated fee
// expressed in satoshis/weight. // expressed in satoshis/weight.
EstimateFeePerWeight(numBlocks uint32) uint64 EstimateFeePerWeight(numBlocks uint32) (btcutil.Amount, error)
} }
// StaticFeeEstimator will return a static value for all fee calculation // StaticFeeEstimator will return a static value for all fee calculation