MultiChain / multichain-explorer

Web-based explorer for MultiChain blockchains
GNU Affero General Public License v3.0
177 stars 140 forks source link

Wrong balance calculation in assetref #11

Closed reiven closed 7 years ago

reiven commented 8 years ago

Hi!

We're seeing something wrong in the "Asset Holders" detail for an asset: Total qty issue: 10000

Asset Holders detail:

12rG66NBkxAz3PhagYP4VABnhHowZLkY1h      250 (transactions)
1L55gwFKQcZ7xoRduNshjagHo84wv4V8CA      19749 (transactions)

But if we enter to the link for second address:

5497900ed32454b5d68626e874f498d536a1e06f8aad800d7b87c51308c92698    13638   1
de45a14a8d81caf740aafee0c477d3d24f60b443411331cb3003593f0ef9d02e    13659   0
df8d0bf989a10470c50b83dd0fc7d8ce9f31c710315b110d2152419319cbc07c    13776   0
4e4ac4dc51eb59344068492f04510b4d3164de6bb3f9ef8e833285fb62eac530    13791   9999
b75bad623f90a28e86054512d19f320f7656ecfaf3e45c3f46954f45583f6618    13803   -250

Also, the balance on the blockchain is correct:

pprint(api.getaddressbalances('1L55gwFKQcZ7xoRduNshjagHo84wv4V8CA')) [{u'assetref': u'13638-266-38740', u'name': u'TEST2', u'qty': 9750.0}, {u'assetref': u'', u'qty': 0.0, u'raw': 0}]

bitcartel commented 8 years ago

If you make a copy of / move the .sqlite file to keep it safe, and start the explorer fresh, letting it scan the blockchain again and create a new sqlite file, do you still see the problem?

Has this chain been created with just one version of Multichain or have you upgraded to newer versions over time?

Also, can you share the data files with me to recreate the issue (need the chain's .multichain folder and explorer .conf file)? Zip file would work. Or let me connect to your network (grant my node full access) to download the chain data.

reiven commented 8 years ago

Hi! I've upgraded multichain daemon to alpha23, re-cloned the repo for blockexplorer and still have issues with the amounts shown for assets holdings.

Where can i send you the files?

reiven commented 8 years ago

Done! you can remove your email address to avoid spam :)

reiven commented 8 years ago

Using RPC, Multichain show correct balance:

api.getaddressbalances('169T785opFSEJJfETa2BCSxsHzrJNAY1Cy') [{u'qty': 9750.0, u'name': u'Test Asset', u'assetref': u'1600-266-50671'}, {u'raw': 0, u'qty': 0.0, u'assetref': u''}]

On Blockexplorer, browsing the address detail:

Asset Name Asset Reference Transactions Raw Units Balance Test Asset 1600-266-50671 4 19749 19749

reiven commented 8 years ago

ping

bitcartel commented 8 years ago

I''ve replicated the issue with your files, looking into it right now.

bitcartel commented 8 years ago

@reiven Pushed a fix. Remove your old .sqlite file and let the explorer rebuild.

reiven commented 7 years ago

thanks @bitcartel , it was fixed correctly