Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getbalance: additional balance fixes #565

Merged
merged 1 commit into from
Mar 8, 2017
Merged

getbalance: additional balance fixes #565

merged 1 commit into from
Mar 8, 2017

Conversation

dajohi
Copy link
Member

@dajohi dajohi commented Feb 15, 2017

  • Include immature coinbase credits
  • SSTXs are not coinbase rewards
  • Also include unconfirmed in the total.
  • Correctly add normal transactions to Spendable when minConf==0
  • Handle unmined stake transactions properly.

wtxmgr/tx.go Outdated
// Make sure this output was not spent by an unmined transaction.
// If it was, skip this credit.
if existsRawUnminedInput(ns, k) != nil {
log.Warnf("existsRawUnminedInput")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this debug

@jrick
Copy link
Member

jrick commented Feb 16, 2017

This is a whole lot of code with no explanation of what is being fixed, why, and how.

@dajohi
Copy link
Member Author

dajohi commented Feb 17, 2017

Updated. The diff is removing if minConf == 0 { } .. but gofmt makes it look bigger :)

@jrick
Copy link
Member

jrick commented Feb 17, 2017

minconf shouldn't be ignored completely, we still need to inspect whether minconf==0 before incrementing the spendable balance.

@marcopeereboom marcopeereboom added this to the 0.9.0 milestone Feb 23, 2017
wtxmgr/tx.go Outdated
default:
log.Warnf("Unhandled unconfirmed opcode %v: %v", opcode, v)
} else {
ab.ImmatureCoinbaseRewards += utxoAmt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a coinbase

wtxmgr/tx.go Outdated
case OP_NONSTAKE:
fallthrough
case txscript.OP_SSTX:
if minConf == 0 {
ab.Spendable += utxoAmt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think spendable is correct here, this is in the stake tree and nothing in there is ever "spendable"

wtxmgr/tx.go Outdated
case txscript.OP_SSRTX:
fallthrough
case txscript.OP_SSTXCHANGE:
ab.ImmatureCoinbaseRewards += utxoAmt
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a coinbase

@dajohi
Copy link
Member Author

dajohi commented Mar 3, 2017

review.

@jrick
Copy link
Member

jrick commented Mar 6, 2017

Needs rebase -- the new file to put these changes in is wallet/udb/txmined.go

And since this also touches unmined transactions, perhaps it could be moved to a better named file. But that can be done in another pr.

@jrick
Copy link
Member

jrick commented Mar 8, 2017

I want this in but it needs a better commit message before it will be accepted. what bugs were fixed?

- Include immature coinbase credits
- SSTXs are not coinbase rewards
- Also include unconfirmed in the total.
- Correctly add normal transactions to Spendable when minConf==0
- Handle unmined stake transactions properly.
@dajohi dajohi changed the title getbalance: more fixes getbalance: additional balance fixes Mar 8, 2017
@alexlyp alexlyp merged commit 82b34ce into decred:master Mar 8, 2017
@dajohi dajohi deleted the balance branch February 28, 2019 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants