chainfee: create new chainfee package extracting fees from lnwallet

In this commit, we create a new chainfee package, that houses all fee
related functionality used within the codebase. The creation of this new
package furthers our long-term goal of extracting functionality from the
bloated `lnwallet` package into new distinct packages. Additionally,
this new packages resolves a class of import cycle that could arise if a
new package that was imported by something in `lnwallet` wanted to use
the existing fee related functions in the prior `lnwallet` package.
This commit is contained in:
Olaoluwa Osuntokun
2019-10-30 19:43:05 -07:00
parent fcf81ed8ff
commit 777ed104a3
47 changed files with 536 additions and 400 deletions

View File

@ -18,6 +18,7 @@ import (
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/input"
"github.com/lightningnetwork/lnd/keychain"
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/lightningnetwork/lnd/shachain"
)
@ -233,7 +234,7 @@ func CreateTestChannels(tweaklessCommits bool) (
return nil, nil, nil, err
}
estimator := NewStaticFeeEstimator(6000, 0)
estimator := chainfee.NewStaticEstimator(6000, 0)
feePerKw, err := estimator.EstimateFeePerKW(1)
if err != nil {
return nil, nil, nil, err