From 3e598f0f7b00b2be335090bf557259fabc5bde82 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Tue, 10 Jan 2017 13:02:03 -0500 Subject: [PATCH] Fix reported spendable balances from coinbase outputs. (#467) Previously, this would not increment the spendable balance for matured coinbase outputs and would only increment the immature balance if the output was still immature. --- wallet/wallet.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/wallet/wallet.go b/wallet/wallet.go index 97025d5..4a31f18 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -700,11 +700,9 @@ func (w *Wallet) CalculateAccountBalances(account uint32, confirms int32) (Balan } bals.Total += output.Amount - if output.FromCoinBase { - target := int32(w.chainParams.CoinbaseMaturity) - if !confirmed(target, output.Height, syncBlock.Height) { - bals.ImmatureReward += output.Amount - } + if output.FromCoinBase && !confirmed(int32(w.chainParams.CoinbaseMaturity), + output.Height, syncBlock.Height) { + bals.ImmatureReward += output.Amount } else if confirmed(confirms, output.Height, syncBlock.Height) { bals.Spendable += output.Amount }