-
Notifications
You must be signed in to change notification settings - Fork 648
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
When signing a block that updates the signing witness's signing key, use correct signing key #125
Comments
Just realized this is not a consensus changing issue, but a bug about generating / signing blocks. Block signing key is checked here before generating the block: bitshares-core/libraries/chain/db_block.cpp Lines 334 to 337 in 60e9314
At a glance the check is done before generating the block, however, actually the check is done with pending transactions, which means the state is dirty -- if there is a Then, when pushing the block, pending transactions will be temporarily removed first, so the code will check whether the block is signed with the old key: bitshares-core/libraries/chain/db_block.cpp Lines 120 to 124 in 60e9314
bitshares-core/libraries/chain/db_block.cpp Lines 664 to 667 in 60e9314
I'll try to fix this. After it's fixed, switching keys (at any time) will no longer cause missing of blocks. |
This code checks signing key before trying to generate a block, which is done with pending transactions / dirty state as well: bitshares-core/libraries/plugins/witness/witness.cpp Lines 253 to 260 in 60e9314
Need to fix. |
When signing key is updated in the same block, producing will fail.
See PR #1203. |
Good catch! |
When signing key is updated in the same block, producing will fail.
Fix issue #125: sign block with old key if signing key updated in same block
Fixed by #1203. |
Interestingly, Steem is moving the whole block generation code to witness plugin: steemit/steem#2861 steemit/steem#2717 |
From @theoreticalbts on November 2, 2015 13:27
If block applies transactions then validates witness signature, we should sign with the new key.
If block validates witness signature then applies transactions, we should sign with the old key.
Copied from original issue: cryptonomex/graphene#430
The text was updated successfully, but these errors were encountered: