mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-04 09:48:19 +01:00
chainfee: replace conf target when it exceeds the maxBlockTarget
In this commit, we add a check inside EstimateFeePerKW for bitcoind so that when the conf target exceeds the maxBlockTarget, we will use maxBlockTarget instead.
This commit is contained in:
parent
6242158d51
commit
5f0561fdbc
1 changed files with 10 additions and 1 deletions
|
@ -375,7 +375,16 @@ func (b *BitcoindEstimator) Stop() error {
|
||||||
// confirmation and returns the estimated fee expressed in sat/kw.
|
// confirmation and returns the estimated fee expressed in sat/kw.
|
||||||
//
|
//
|
||||||
// NOTE: This method is part of the Estimator interface.
|
// NOTE: This method is part of the Estimator interface.
|
||||||
func (b *BitcoindEstimator) EstimateFeePerKW(numBlocks uint32) (SatPerKWeight, error) {
|
func (b *BitcoindEstimator) EstimateFeePerKW(
|
||||||
|
numBlocks uint32) (SatPerKWeight, error) {
|
||||||
|
|
||||||
|
if numBlocks > maxBlockTarget {
|
||||||
|
log.Debugf("conf target %d exceeds the max value, "+
|
||||||
|
"use %d instead.", numBlocks, maxBlockTarget,
|
||||||
|
)
|
||||||
|
numBlocks = maxBlockTarget
|
||||||
|
}
|
||||||
|
|
||||||
feeEstimate, err := b.fetchEstimate(numBlocks)
|
feeEstimate, err := b.fetchEstimate(numBlocks)
|
||||||
switch {
|
switch {
|
||||||
// If the estimator doesn't have enough data, or returns an error, then
|
// If the estimator doesn't have enough data, or returns an error, then
|
||||||
|
|
Loading…
Add table
Reference in a new issue