Skip to content

Fix for importaddress returning incorrect amounts #479

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

Merged
merged 8 commits into from
May 21, 2019

Conversation

digitaloten
Copy link
Contributor

Fix for importaddress returning incorrect amounts

This is for Issue #193

@aguycalled
Copy link
Member

aguycalled commented May 10, 2019

The PR does not exactly address the issue. Maybe the description is not clear enough, but I think he refers to an issue when importing cold staking addresses.

@digitaloten
Copy link
Contributor Author

@aguycalled Updated the test case to include cold staking addresses.

@aguycalled
Copy link
Member

just tested it, importing the spending or staking address in the second node does not show the balance as if it was an address owned by the wallet.

@digitaloten
Copy link
Contributor Author

@aguycalled oh, i assumed that the balance from addresses imported were not to be shown as if it was owned by the wallet, but only show transactions on the watched address. In this case, should commands like getbalance be updated to include balances from watched addresses?

@aguycalled
Copy link
Member

you are right, only the transactions are watched, but those do not appear for spending or staking addresses.

@mxaddict
Copy link
Contributor

you are right, only the transactions are watched, but those do not appear for spending or staking addresses.

So does that mean:

ZZZ = normal address # Has balance
XXX = staking # No balance
YYY = spending # No balance
[YYY,XXX] = cold address # Has balance

Import ZZZ = works (You see transactions + correct amount)
Import XXX = (does this work?)
Import YYY = (does this work?)
Import [YYY,XXX] = works (You see transactions + correct amount)

@aguycalled
Copy link
Member

you are right, only the transactions are watched, but those do not appear for spending or staking addresses.

So does that mean:

ZZZ = normal address # Has balance
XXX = staking # No balance
YYY = spending # No balance
[YYY,XXX] = cold address # Has balance

Import ZZZ = works (You see transactions + correct amount)
Import XXX = (does this work?)
Import YYY = (does this work?)
Import [YYY,XXX] = works (You see transactions + correct amount)

yes

@mxaddict
Copy link
Contributor

@francisjyap I think you just need to add those scenarios to the functional test, then fix the issue 👍 if it still exists.

@aguycalled so the balance is not supposed to update, only the transactions list correct?

@aguycalled
Copy link
Member

aguycalled commented May 14, 2019

watchonly addresses balance is only shown in qt iirc

@digitaloten
Copy link
Contributor Author

@mxaddict @aguycalled I updated the test cases per your suggestions and the transactions and balance from the imported addresses are reflected correctly.

I added a Watched label on the UI showing the total balance from watched addresses. The Total label is also updated to reflect the total balance plus the total watched balance.

@mxaddict
Copy link
Contributor

mxaddict commented May 15, 2019 via email

Copy link
Contributor

@mxaddict mxaddict left a comment

Choose a reason for hiding this comment

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

Tested on Ubuntu 18.04

Screenshot from 2019-05-15 21-52-41

Seems legit 👍

But I would like some changes


#import time

class GetStakeReport(NavCoinTestFramework):
Copy link
Contributor

Choose a reason for hiding this comment

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

This should match the name of the test



if __name__ == '__main__':
GetStakeReport().main()
Copy link
Contributor

Choose a reason for hiding this comment

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

Needs to match the name of the file

self.nodes[2].importaddress(address)
self.nodes[2].importaddress(spending_address)
self.nodes[2].importaddress(staking_address)
self.nodes[2].importaddress(coldstaking_address)
Copy link
Member

Choose a reason for hiding this comment

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

if you import both the spending/staking and the cold staking address, you can't discern if the txs are seen because the wallet is watching the cold staking address (which was already working) or because it is watching the spending/staking addresses (which were not working before). I'd suggest a setup with one node for each case.

@mxaddict
Copy link
Contributor

@francisjyap any updates on this issue?

@digitaloten
Copy link
Contributor Author

digitaloten commented May 21, 2019

@aguycalled @mxaddict So i found out what was causing the cold staking transactions from not appearing when importing a staking/spending address. Cold staking txs would only compare against addresses that are owned by the wallet and not against watched addresses. I also updated the test case.

@mxaddict
Copy link
Contributor

mxaddict commented May 21, 2019 via email

@aguycalled
Copy link
Member

utACK

Copy link
Contributor

@mxaddict mxaddict left a comment

Choose a reason for hiding this comment

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

Tested and working on Ubuntu 18.04

@mxaddict
Copy link
Contributor

Full test suite + new test cases for this scenario also pass

@aguycalled
Copy link
Member

Tested OSX

@aguycalled
Copy link
Member

paid 5ab73dece539ab5a29b196a4af43e1834c9a5e35da1c977b92d71a005fb4feed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants