virtual-op-fix for deterministic virtual_op number
This commit is contained in:
parent
0b8c495707
commit
75f16752d2
3 changed files with 14 additions and 2 deletions
|
|
@ -587,6 +587,8 @@ void database::_apply_block( const signed_block& next_block )
|
||||||
|
|
||||||
_current_block_num = next_block_num;
|
_current_block_num = next_block_num;
|
||||||
_current_trx_in_block = 0;
|
_current_trx_in_block = 0;
|
||||||
|
_current_op_in_trx = 0;
|
||||||
|
_current_virtual_op = 0;
|
||||||
|
|
||||||
for( const auto& trx : next_block.transactions )
|
for( const auto& trx : next_block.transactions )
|
||||||
{
|
{
|
||||||
|
|
@ -596,8 +598,16 @@ void database::_apply_block( const signed_block& next_block )
|
||||||
* for transactions when validating broadcast transactions or
|
* for transactions when validating broadcast transactions or
|
||||||
* when building a block.
|
* when building a block.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
apply_transaction( trx, skip );
|
apply_transaction( trx, skip );
|
||||||
|
// For real operations which are explicitly included in a transaction, virtual_op is 0.
|
||||||
|
// For VOPs derived directly from a real op,
|
||||||
|
// use the real op's (block_num,trx_in_block,op_in_trx), virtual_op starts from 1.
|
||||||
|
// For VOPs created after processed all transactions,
|
||||||
|
// trx_in_block = the_block.trsanctions.size(), virtual_op starts from 0.
|
||||||
++_current_trx_in_block;
|
++_current_trx_in_block;
|
||||||
|
_current_op_in_trx = 0;
|
||||||
|
_current_virtual_op = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global_props.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SCHEDULED_ALGORITHM)
|
if (global_props.parameters.witness_schedule_algorithm == GRAPHENE_WITNESS_SCHEDULED_ALGORITHM)
|
||||||
|
|
@ -708,8 +718,10 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx
|
||||||
//Finally process the operations
|
//Finally process the operations
|
||||||
processed_transaction ptrx(trx);
|
processed_transaction ptrx(trx);
|
||||||
_current_op_in_trx = 0;
|
_current_op_in_trx = 0;
|
||||||
|
_current_virtual_op = 0;
|
||||||
for( const auto& op : ptrx.operations )
|
for( const auto& op : ptrx.operations )
|
||||||
{
|
{
|
||||||
|
_current_virtual_op = 0;
|
||||||
eval_state.operation_results.emplace_back(apply_operation(eval_state, op));
|
eval_state.operation_results.emplace_back(apply_operation(eval_state, op));
|
||||||
++_current_op_in_trx;
|
++_current_op_in_trx;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -549,7 +549,7 @@ namespace graphene { namespace chain {
|
||||||
uint32_t _current_block_num = 0;
|
uint32_t _current_block_num = 0;
|
||||||
uint16_t _current_trx_in_block = 0;
|
uint16_t _current_trx_in_block = 0;
|
||||||
uint16_t _current_op_in_trx = 0;
|
uint16_t _current_op_in_trx = 0;
|
||||||
uint16_t _current_virtual_op = 0;
|
uint32_t _current_virtual_op = 0;
|
||||||
|
|
||||||
vector<uint64_t> _vote_tally_buffer;
|
vector<uint64_t> _vote_tally_buffer;
|
||||||
vector<uint64_t> _witness_count_histogram_buffer;
|
vector<uint64_t> _witness_count_histogram_buffer;
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ namespace graphene { namespace chain {
|
||||||
/** the operation within the transaction */
|
/** the operation within the transaction */
|
||||||
uint16_t op_in_trx = 0;
|
uint16_t op_in_trx = 0;
|
||||||
/** any virtual operations implied by operation in block */
|
/** any virtual operations implied by operation in block */
|
||||||
uint16_t virtual_op = 0;
|
uint32_t virtual_op = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue