lnwallet: correct BTC -> SAT conversion in BtcdFeeEstimator

In this commit, we correct the BTC -> SAT conversion in
BtcdFeeEstimator. Previously, we use 10e8 instead of 1e8, causing us to
be off by an order of magnitude.
This commit is contained in:
Olaoluwa Osuntokun 2017-11-26 13:35:25 -06:00
parent 91bb95991e
commit 52e6cb1a06
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21
1 changed files with 5 additions and 2 deletions

View File

@ -173,12 +173,15 @@ func (b *BtcdFeeEstimator) fetchEstimatePerByte(confTarget uint32) (btcutil.Amou
// Next, we'll convert the returned value to satoshis, as it's
// currently returned in BTC.
satPerKB := uint64(btcPerKB * 10e8)
satPerKB, err := btcutil.NewAmount(btcPerKB)
if err != nil {
return 0, err
}
// The value returned is expressed in fees per KB, while we want
// fee-per-byte, so we'll divide by 1024 to map to satoshis-per-byte
// before returning the estimate.
satPerByte := btcutil.Amount(satPerKB / 1024)
satPerByte := satPerKB / 1024
walletLog.Debugf("Returning %v sat/byte for conf target of %v",
int64(satPerByte), confTarget)