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:
yyforyongyu committed 2021-06-29 20:25:46 +08:00
1 parent 6242158d51
commit 5f0561fdbc
1 file changed
+10 -1
+10 -1
View File
@@ -375,7 +375,16 @@ func (b *BitcoindEstimator) Stop() error {
// confirmation and returns the estimated fee expressed in sat/kw.
//
// 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)
switch {
// If the estimator doesn't have enough data, or returns an error, then