-
Notifications
You must be signed in to change notification settings - Fork 154
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
Conversation
dajohi
commented
Feb 15, 2017
•
edited
Loading
edited
- 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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this debug
This is a whole lot of code with no explanation of what is being fixed, why, and how. |
Updated. The diff is removing if minConf == 0 { } .. but gofmt makes it look bigger :) |
minconf shouldn't be ignored completely, we still need to inspect whether minconf==0 before incrementing the spendable balance. |
wtxmgr/tx.go
Outdated
default: | ||
log.Warnf("Unhandled unconfirmed opcode %v: %v", opcode, v) | ||
} else { | ||
ab.ImmatureCoinbaseRewards += utxoAmt |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a coinbase
review. |
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. |
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.