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

synchronisation edge case in CheckBlockConnectTemplate #1534

Open
l0k18 opened this issue Feb 6, 2020 · 0 comments
Open

synchronisation edge case in CheckBlockConnectTemplate #1534

l0k18 opened this issue Feb 6, 2020 · 0 comments

Comments

@l0k18
Copy link
Contributor

l0k18 commented Feb 6, 2020

b.chainLock.Lock()

I have been working on some changes in a forked repository and was having problems with, after some several hundred blocks, templates being made with zero target Bits. I searched around using the handy trace logging system I created to try and find where the problem was originating, and eventually stumbled onto this function.

It appears that this mutex is locked prematurely, by moving the lock and defer down to the first instance of the actual access to the b.Chain the bug completely disappeared. If nobody can see any reason why to not also do this to the btcd codebase as well, as I expect the mining functionality of btcd hasn't been exercised very much, then it should be because it resolved a problem that clearly must have been caused by improper synchronisation.

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

No branches or pull requests

2 participants