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.
This commit is contained in:
Josh Rickmar 2017-01-10 13:02:03 -05:00 committed by GitHub
parent 426c2e9f64
commit 3e598f0f7b

View file

@ -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
}