lnwallet: fix coin selection, translate to satoshis

This commit is contained in:
Olaoluwa Osuntokun 2015-11-28 18:13:04 -06:00
parent 06e5544428
commit 627192f493
1 changed files with 5 additions and 3 deletions

View File

@ -43,12 +43,14 @@ func newLnCoin(output *btcjson.ListUnspentResult) (coinset.Coin, error) {
} }
return &lnCoin{ return &lnCoin{
hash: txid, hash: txid,
value: btcutil.Amount(output.Amount), // btcjson.ListUnspentResult shows the amount in BTC,
// translate into Satoshi so coin selection can work properly.
value: btcutil.Amount(output.Amount * 1e8),
index: output.Vout, index: output.Vout,
pkScript: pkScript, pkScript: pkScript,
numConfs: output.Confirmations, numConfs: output.Confirmations,
// TODO(roasbeef) outpout.Amount should be a int64 :/ // TODO(roasbeef): output.Amount should be a int64, damn json-RPC :/
valueAge: output.Confirmations * int64(output.Amount), valueAge: output.Confirmations * int64(output.Amount),
}, nil }, nil
} }