-
Notifications
You must be signed in to change notification settings - Fork 101
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
Lock cs_main for TestBlockValidity #486
Conversation
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.
I agree with this fix.
Actually I have already added this lock in my experimental branches. I did load tests with and without it and got -25 mempool errors when the lock omitted
Actually
It will be more clear and make the codebase following bitcoin upstream at the same time. Actually we have a lot of things which are implemented in Bitcoin, but absent in Komodo ... if you'll look on ZCash codebase - they trying to merge Bitcoin upstream step-by-step ... my opinion - we should do the same first: try to take the best from Bitcoin upstream and minimize introducing p.s. All of above is just my personal opinion. |
maybe let's now replace LastTip everywhere (it is really confusing) |
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.
maybe this function GetLastTipWithLock() is not needed as we agreed not to use it
the conflict needs to be resolved |
Conflict resolved. |
I am running my NN on this code, seems this code is okay. |
LGTM, but I did not personally test as I no longer have access to a notary. |
- KomodoPlatform/komodo#486 Also we get rid of LastTip() calls in this PR, changed them to Tip().
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.
LGTM generallу.
p.s. May be we also need to include this changes zcash#5853 in this PR. Good to have protection if chain tip is nullptr somehow. I added this change to Komodo-Qt codebase.
p.p.s. Also github web ui shows that this PR changes marmara.cpp
which is absent at the moment. As I remember we get rid of it earlier, or I did it only in Komodo-Qt codebase.
Currently this code Line 2016 in d456be3
But there is a bad thing that if fShutdown is set chainActive still may be empty. So I think first we should add a return false if fShutdown is true. And we could also add zcash#5853 for better safety |
I remember jmjatlanta intended to remove marmara.cpp but now I have all his PRs merged in my branch and marmara.cpp is still here. Maybe he did not make a PR with this removal |
these changes implemented in combined PR: #559 |
Fixes issue #483
The BitcoinMiner() did not properly lock cs_main before using chainActive or calling TestBlockValidity.
I have verified that all other calls to TestBlockValidity maintain the lock on cs_main before the call.