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

Database indexing: fix mismatching balances/sent/received, negative balances etc #316

Closed

Conversation

TheHolyRoger
Copy link
Collaborator

@TheHolyRoger TheHolyRoger commented Dec 16, 2019

Currently testing these changes out with a reindex to see if the balance discrepancies are resolved.

Would fix:
#293
uaktags#42
sugarchain-project#13

Relates to changes since:
#6

So far everything seems to be working well now - if you do have balance issues then you'll want to reindex after merging this PR. I advise turning on the lock_during_index setting to ensure API calls don't mess up balances out of order.

A reindex is NOT required with this PR - only advised if you have balance issues.

@TheHolyRoger TheHolyRoger force-pushed the devfix-balance_mismatch branch 5 times, most recently from 33967bd to a4677a4 Compare December 18, 2019 21:19
@TheHolyRoger
Copy link
Collaborator Author

Includes new db lock setting during indexing and also displays initial_index_alert warning whilst locked.

I found that allowing API requests to save transactions out of order during indexing causes balance issues, whilst this new setting limits functionality during indexing, it does help ensure balances are accurate.

@TheHolyRoger
Copy link
Collaborator Author

@uaktags @cryptozeny @iquidus would appreciate your thoughts

@cryptozeny
Copy link

wow i will look as soon as possible

received = received + amount;
}
if (unique == true) {
if ((unique == true) || (type != tx_array[index].type)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There was some duplicated code here, have stripped it down as it wasn't catching tx's sent to self properly

Copy link
Contributor

@minkcrypto-zz minkcrypto-zz left a comment

Choose a reason for hiding this comment

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

ACK

@TheHolyRoger
Copy link
Collaborator Author

Included in PR #319

@TheHolyRoger TheHolyRoger deleted the devfix-balance_mismatch branch December 21, 2019 11:20
@TheHolyRoger TheHolyRoger restored the devfix-balance_mismatch branch December 21, 2019 11:21
@cryptozeny
Copy link

cryptozeny commented Dec 21, 2019

i cherry picked this commit, and rebuilt explorer, but still same. i will try node scripts/sync.js index reindex
image
this final balance should be zero.

@TheHolyRoger
Copy link
Collaborator Author

Continued in #319

@cryptozeny
Copy link

cryptozeny commented Dec 23, 2019

i did node scripts/sync.js index reindex but this made recent block heights wrong. mostly got same number.

2035839: da1f0829a5f1c8ac2aa78d5b240f3da5ed17fac799d16c05fdf1102fbcfdd5ba
2035839: 33ab0ac40e23674848dc3593699a61455d53943f303963f5165dcc34be53accb
2035839: eb78adfabc087903fbac668d8a0ef7ce069192640c45be0bd8e8d6e0e0327bcc
2035839: 4be01c1d5c6fc8429a3aa1cc58b06a219827ab10a9b17f044c9fc83892f183d3
2035839: 11cb601859b68ee726d18535767244ae7eef7d5cae768996d3521b01ddefd6d8
2035839: 28941b3b142be2e6bbc810773bb4f48cd085de972e9515e1dde532fc026ce0e0
2035839: 4830a967445e482b826d5e3fa35e0964c3c416e697b719eb4a2f2c194f35e0e4
2035839: a24f41b8724996bb8c27d60a66602f4c374e3d6fdf7ac506cb5e8c33cac1f8e4
2035839: cac9b718e993fd746d7e758efcd75a34903e4235387f4ebe529959f5de2340e9
2035839: b21b117f8b77b0c6c5aefb885315ad14c19df9e5c1dc2ce264a8ac9cef2cb800
2035839: c775fa00b06a5a4157c5ba0fa1878948c83b570834d27d1d99fa54becc588d17
2035839: 96cdecbb1d7bf8941a7b2275c8abb231f8ac3424351c4e4d7b6723a4b2715419
2035839: c698c22d7df359a3fe004310c1571448bf929e3e37d8787265d1159c1f6ed81b
2035840: 634d0debc0cc8eb20842061b197fe3f577d0f5e86fa70fbf3375bcecbf43bbc5
2035840: 54c0fac3645aee226a8d040e6354b64d0239651cec3c7935e757c417b1196423
2035840: d92ef217b3f9cca3c5920cd171bac5a92a90aaf055592600863a1a14f6d5dd2a
2035840: 344554e71c966af41ffde135eef879fde67ee0d5651c909f4e7ab704ed155131
2035840: 5a0818ee9c7bed6af706f01ff5207f03ec47a1ca010f161ee9d5bd2c946bbb35
2035840: bb3342a58e0e210ab7494b2e257dbba2e1770f625fc09c10c68849c35ecd1938
2035840: d892b0bd7eb248f3642b8e0040763c8462ef01d02e751502db158c845bba7541
2035840: c38940b0c52fc875a1162300b9b5f99ba06e850fba8b4dc7341ec28142aa0842
2035840: fe53d8afc536b8bf55a170a1fbc5dbfa90d8eb0c7c8c51f1251cd979a8de3848

image

@TheHolyRoger TheHolyRoger deleted the devfix-balance_mismatch branch December 28, 2019 10:23
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.

None yet

3 participants