lnwallet/btcwallet: fix bug in implementation of GetUxo

This commit fixes a bug within the btcwallet implementation of the
BlockChainIO interface. The exact nature of the bug was a rounding
error that would only manifest if the value of the UTXO was below 1
BTC.

The tests within this package currently test channels with mostly whole
values of BTC, as a result the bug went unnoticed until now.

The fix itself is trivial: convert to an int64 AFTER performing the
multiplication to convert to satoshis from Bitcoin.
This commit is contained in:
Olaoluwa Osuntokun 2016-12-24 18:26:44 -06:00
parent 78ce39692e
commit 4a0a657eb0
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
1 changed files with 1 additions and 1 deletions

View File

@ -32,7 +32,7 @@ func (b *BtcWallet) GetUtxo(txid *wire.ShaHash, index uint32) (*wire.TxOut, erro
return &wire.TxOut{
// Sadly, gettxout returns the output value in BTC
// instead of satoshis.
Value: int64(txout.Value) * 1e8,
Value: int64(txout.Value * 1e8),
PkScript: pkScript,
}, nil
}