From 627192f493f26d6865846e62196c6ec61aa36762 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sat, 28 Nov 2015 18:13:04 -0600 Subject: [PATCH] lnwallet: fix coin selection, translate to satoshis --- wallet/coin_select.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wallet/coin_select.go b/wallet/coin_select.go index 0f740446..739ed333 100644 --- a/wallet/coin_select.go +++ b/wallet/coin_select.go @@ -43,12 +43,14 @@ func newLnCoin(output *btcjson.ListUnspentResult) (coinset.Coin, error) { } return &lnCoin{ - hash: txid, - value: btcutil.Amount(output.Amount), + hash: txid, + // 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, pkScript: pkScript, 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), }, nil }