@@ -552,6 +552,12 @@ void database::_apply_block( const signed_block& next_block )
552
552
const auto & dynamic_global_props = get_dynamic_global_properties ();
553
553
bool maint_needed = (dynamic_global_props.next_maintenance_time <= next_block.timestamp );
554
554
555
+ // trx_in_block starts from 0.
556
+ // For real operations which are explicitly included in a transaction, op_in_trx starts from 0, virtual_op is 0.
557
+ // For virtual operations that are derived directly from a real operation,
558
+ // use the real operation's (block_num,trx_in_block,op_in_trx), virtual_op starts from 1.
559
+ // For virtual operations created after processed all transactions,
560
+ // trx_in_block = the_block.trsanctions.size(), op_in_trx is 0, virtual_op starts from 0.
555
561
_current_block_num = next_block_num;
556
562
_current_trx_in_block = 0 ;
557
563
@@ -569,6 +575,9 @@ void database::_apply_block( const signed_block& next_block )
569
575
++_current_trx_in_block;
570
576
}
571
577
578
+ _current_op_in_trx = 0 ;
579
+ _current_virtual_op = 0 ;
580
+
572
581
const uint32_t missed = update_witness_missed_blocks ( next_block );
573
582
update_global_dynamic_data ( next_block, missed );
574
583
update_signing_witness (signing_witness, next_block);
@@ -671,6 +680,7 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx
671
680
_current_op_in_trx = 0 ;
672
681
for ( const auto & op : ptrx.operations )
673
682
{
683
+ _current_virtual_op = 0 ;
674
684
eval_state.operation_results .emplace_back (apply_operation (eval_state, op));
675
685
++_current_op_in_trx;
676
686
}
0 commit comments