-
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
Now is not always now #1198
Comments
Proposed solution: Add new properties in addition to head_block_time and head_block_num called current_block_time and current_block_num. These will be set to head_block_time and head_block_num unless you are processing a block. They should also be rolled back in the case of an exception that stops block processing. Transaction and other processing that can happen within a block should use the new fields. Anything outside that process can continue to use head_block_??? Note: This can mean some metadata within things like transactions can change. i.e. a transaction being moved from pending to within a block will have their block time and number changed. I have not researched the implications of this, but believe it to be okay, as there are no guarantees that pending transactions will end up in a particular block. |
there are no guarantees that pending transactions will end up in a particular block, and there can be different reasons, not only due time, but also due to size. |
Don't forget block generation. That currently uses head_block_time of the block that it is building upon. I agree that the current implementation is not nice and may lead to surprising results sometimes, but it doesn't hurt very much in practice. Changing it requires significant effort and will forever pollute our codebase with a hardfork. |
After examining the issue, I must agree with @pmconrad. If all agree, we will mark this as a wontfix. |
Won't fix. |
Bug Description
When processing a block, we usually use
database::head_block_time()
akadynamic_global_properties.time
to indicate "now". We also usedatabase::head_block_num()
. However, these variables are updated in the middle of the process, specifically, indatabase::update_global_dynamic_data()
, after processed transactions:bitshares-core/libraries/chain/db_block.cpp
Lines 520 to 524 in 44a7c47
It means when processing transactions, we're using the time and block number of last block. Technically it is not a big deal, but it has brought some confusions, for example:
Impacts
Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.
Expected Behavior
Block time and block number should be consistent when processing a block.
Additional Context (optional)
This change requires a consensus upgrade. Do we need to correct/update old data after the upgrade?
CORE TEAM TASK LIST
The text was updated successfully, but these errors were encountered: