bitshares / bitshares-core

BitShares Blockchain node and command-line wallet
https://bitshares.github.io/
Other
1.17k stars 643 forks source link

`operation_history_object::virtual_op` numbering may be discontinuous (possibly with holes) #2692

Open abitmore opened 1 year ago

abitmore commented 1 year ago

Bug Description

In database::push_applied_operation(), after _current_virtual_op is assigned to virtual_op of the newly created operation_history_object, _current_virtual_op++ is called: https://github.com/bitshares/bitshares-core/blob/f812666bb3bb884f6e8e5e7e669dc0050d3f3a69/libraries/chain/db_block.cpp#L535-L544

If the operation being pushed is in a proposal, after it is added to _applied_ops, it may be removed later if the proposal fails, but _current_virtual_op is not updated back: https://github.com/bitshares/bitshares-core/blob/f812666bb3bb884f6e8e5e7e669dc0050d3f3a69/libraries/chain/db_block.cpp#L361-L364

I'm not sure if it is worth fixing.

https://github.com/bitshares/bitshares-core/issues/1675 is related.

Impacts Describe which portion(s) of BitShares Core may be impacted by this bug. Please tick at least one box.

Host Environment Please provide details about the host environment. Much of this information can be found running: witness_node --version.

CORE TEAM TASK LIST