Open hans-schmidt opened 3 years ago
Could we switch to rescanblockchain in the wallet repair tab functions to avoid the problem for the time being?
Unfortunately, my statement "rescanblockchain from console always works" is my experience, but it's not theoretically true, depending on what else is going on in the background. The only way to be certain of success is to schedule a rescan, try to lock all the resources and wait for the lock to succeed, and then do the rescan. That is why I proposed that the "rescan" function needs to be re-written in a scheduling function (which is what bitcoin did).
Do you have links to bitcoin issues/prs for this?
Issue has funding address in https://rvn.cryptoscope.io/address/?address=RKQRAWqnPwxCyGx4Ms8gqaLXdjLFqsLR2r bounty held by by Raven_Angels community. Contact Raven_Angels here https://discord.gg/SR3q2C8C. Donations welcome to support this specific issue by sending to the address above. RKQRAWqnPwxCyGx4Ms8gqaLXdjLFqsLR2r
Any code pull request (PR) added for a bounty must include test units and include changes requested by the commenting and reviewing devs and community at large that improve the security and useability of the code within the scope of the issue. The dev creating the PR with all the above receives the bounty. That dev may share the bounty with whoever they choose.
The "rescan" function needs to be re-written in a scheduling function. It's buggy because there is a race between setting everything up during raven-qt initialization, and using the resources in memory for the rescan. We inherited this bug from bitcoin, but they made many other changes before fixing it, so it's not a cut/paste fix we can take from them. "rescanblockchain" from debug console always works because it avoids the race condition by being requested after everything is stable in memory. There are unfortunately some situations when the rescan bug can cause balance & transactions to get messed up if you import keys or addresses because the triggered rescan fails. It's all a bit flaky because the rescan bug is a code race condition and thus hardware specific.
Since people don't know about this bug and the wallet repair tab "rescan" option doesn't work, they end up doing a VERY long reindex to repair a wallet balance error or to initialize wallet balance after creating a new wallet from previously used mnemonic seed words, when just a fast "rescanblockchain" from the debug console would suffice.