-
Notifications
You must be signed in to change notification settings - Fork 37.8k
rpc: Avoid "duplicate" return value for invalid submitblock #13395
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
Conversation
Note to reviewers: This pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
Is @DrahtBot a new addition to the project? Who is the bot owner? :-) |
An evil paperclip robot, I don't know whose it is. But it seems useful. utACK fa4125621554f2f94fded1896ba7eae10ef954da |
utACK fa41256. Nit, |
This breaks having two submitblocks in paralell. Now instead of one returning true and the other duplicate, you might have one return true and one simply return "inconclusive". I think the correct fix is to just set fBlockPresent to pindex->nStatus & HAVE_DATA. |
@TheBlueMatt I don't see how this fixes the race. The only other option I see is to partially revert the commit that introduced the bug (eb63bf8), i.e. read from mapBlockIndex after |
Ah, indeed, must have been introduced on master when ProcessNewBlock lost its cs_main at call-time. Obvious fix would be to duplicate the fBlockPresent check after PNB by re-acquiring cs_main. |
fa88011
to
fa41256
Compare
utACK Maybe DrahtBot can rebase my PR for me once this is merged ;-) |
fa189e0
to
faf9233
Compare
I force pushed the commit with two changes:
Should be easy to re-ACK |
faf9233
to
fa08ebd
Compare
utACK fa08ebd7f24fc911b1af14644e4e235b6f3f9316 |
re-utACK fa08ebd. |
fa08ebd
to
fa6e497
Compare
Why close? |
To indicate that it was up for grabs. |
I don't get it. If this is up for grabs you think it should be merged, but you don't want to maintain it? It's currently mergeable and has ACKs. Why not just leave it open? |
Please see #13439. The changes here weren't sufficient, needed one more commit to actually fix the issue mentioned. |
Got it. Good to know. Thanks Matt! |
…lock f748944 Only set fNewBlock to true in AcceptBlock when we write to disk (Matt Corallo) fa6e497 rpc: Avoid "duplicate" return value for invalid submitblock (MarcoFalke) Pull request description: This is #13395 with one more commit tacked on. MarcoFalke got tired of dealing with the stupidity of fixing a return code with too many rounds of review (not that I blame him). Honestly we should probably have no return whatsoever, but for now, this fixes it (as well as nLastBlockTime for eviction purposes). Original description: When `submitblock` of an invalid block, the return value should not be `"duplicate"`. This is only seen when the header was previously found (denoted by the incorrectly named boolean `fBlockPresent`). Fix this bug by removing `fBlockPresent`. Tree-SHA512: 0ce3092655d5d904b4c8c5ff7479f73ce387144a738f20472b8af132564005c6db5594ae366e589508f6258506ee7a28b1c7995a83a8328b334f99316006bf2d
…submitblock f748944 Only set fNewBlock to true in AcceptBlock when we write to disk (Matt Corallo) fa6e497 rpc: Avoid "duplicate" return value for invalid submitblock (MarcoFalke) Pull request description: This is bitcoin#13395 with one more commit tacked on. MarcoFalke got tired of dealing with the stupidity of fixing a return code with too many rounds of review (not that I blame him). Honestly we should probably have no return whatsoever, but for now, this fixes it (as well as nLastBlockTime for eviction purposes). Original description: When `submitblock` of an invalid block, the return value should not be `"duplicate"`. This is only seen when the header was previously found (denoted by the incorrectly named boolean `fBlockPresent`). Fix this bug by removing `fBlockPresent`. Tree-SHA512: 0ce3092655d5d904b4c8c5ff7479f73ce387144a738f20472b8af132564005c6db5594ae366e589508f6258506ee7a28b1c7995a83a8328b334f99316006bf2d
…submitblock f748944 Only set fNewBlock to true in AcceptBlock when we write to disk (Matt Corallo) fa6e497 rpc: Avoid "duplicate" return value for invalid submitblock (MarcoFalke) Pull request description: This is bitcoin#13395 with one more commit tacked on. MarcoFalke got tired of dealing with the stupidity of fixing a return code with too many rounds of review (not that I blame him). Honestly we should probably have no return whatsoever, but for now, this fixes it (as well as nLastBlockTime for eviction purposes). Original description: When `submitblock` of an invalid block, the return value should not be `"duplicate"`. This is only seen when the header was previously found (denoted by the incorrectly named boolean `fBlockPresent`). Fix this bug by removing `fBlockPresent`. Tree-SHA512: 0ce3092655d5d904b4c8c5ff7479f73ce387144a738f20472b8af132564005c6db5594ae366e589508f6258506ee7a28b1c7995a83a8328b334f99316006bf2d
…submitblock f748944 Only set fNewBlock to true in AcceptBlock when we write to disk (Matt Corallo) fa6e497 rpc: Avoid "duplicate" return value for invalid submitblock (MarcoFalke) Pull request description: This is bitcoin#13395 with one more commit tacked on. MarcoFalke got tired of dealing with the stupidity of fixing a return code with too many rounds of review (not that I blame him). Honestly we should probably have no return whatsoever, but for now, this fixes it (as well as nLastBlockTime for eviction purposes). Original description: When `submitblock` of an invalid block, the return value should not be `"duplicate"`. This is only seen when the header was previously found (denoted by the incorrectly named boolean `fBlockPresent`). Fix this bug by removing `fBlockPresent`. Tree-SHA512: 0ce3092655d5d904b4c8c5ff7479f73ce387144a738f20472b8af132564005c6db5594ae366e589508f6258506ee7a28b1c7995a83a8328b334f99316006bf2d
When
submitblock
of an invalid block, the return value should not be"duplicate"
.This is only seen when the header was previously found (denoted by the incorrectly named boolean
fBlockPresent
). Fix this bug by removingfBlockPresent
.