Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions chainbackends/lndclient_adapters.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,25 @@ func (e *LndClientFeeEstimator) Stop() error {
return nil
}

// EstimateFeePerKW returns the estimated fee rate in satoshis per kilo-weight
// unit for the given confirmation target.
// EstimateFeePerKW returns the estimated fee rate in satoshis per
// kilo-weight unit for the given confirmation target.
func (e *LndClientFeeEstimator) EstimateFeePerKW(
numBlocks uint32) (chainfee.SatPerKWeight, error) {

ctx, cancel := context.WithTimeout(
context.Background(), 30*time.Second,
)
defer cancel()
satPerVByte, err := e.walletKit.EstimateFeeRate(

// EstimateFeeRate already returns chainfee.SatPerKWeight
// (it does SatPerKWeight(resp.SatPerKw) internally).
satPerKw, err := e.walletKit.EstimateFeeRate(
ctx, int32(numBlocks),
)
if err != nil {
return 0, fmt.Errorf("estimate fee rate: %w", err)
}

satPerKw := chainfee.SatPerVByte(satPerVByte).FeePerKWeight()

return satPerKw, nil
}

Expand Down
Loading