account_history_api.enum_virtual_ops result sometimes contains non-virtual ops
Calls to account_history_api.enum_virtual_ops
can sometimes contain non-virtual ops.
The most reliable condition to recreate this is to provide a block range that includes the head block while also passing include_reversible = true
.
For example, this script will output a mix of virtual ops and non-virtual ops. Note, it requires apt-get install jq
to process the json output.
Call it verify_enum_virtual_ops.sh
:
#!/bin/bash
block_num_begin=$(\
curl -s --data '{
"jsonrpc": "2.0",
"method": "database_api.get_dynamic_global_properties",
"params": {},
"id":1
}' https://api.hive.blog | jq -r .result.head_block_number
)
((block_num_end=block_num_begin+1))
curl -s --data "{
\"jsonrpc\": \"2.0\",
\"method\": \"account_history_api.enum_virtual_ops\",
\"params\": {
\"block_range_begin\": $block_num_begin,
\"block_range_end\": $block_num_end,
\"include_reversible\": true
},
\"id\": 2
}" https://api.hive.blog | jq -r '.result.ops[] | "\(.block) \(.virtual_op) \(.op.type)"'
Example output:
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 feed_publish_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 claim_reward_balance_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 claim_reward_balance_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 1 producer_reward_operation
52939798 2 comment_payout_update_operation
52939798 3 comment_payout_update_operation
52939798 0 custom_json_operation
52939798 0 transfer_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 1 fill_order_operation
52939798 0 limit_order_create_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 0 claim_reward_balance_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 limit_order_cancel_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 1 effective_comment_vote_operation
52939798 0 vote_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 comment_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
52939798 0 custom_json_operation
You can see that the output includes non-virtual operations:
52939798 0 custom_json_operation
Not only is this operation type non-virtual, but the virtual_op
index is also zero. A workaround for API clients is to filter on virtual_op = 0
.
(tested in blockchain version 1.24.8, rev:54fa6a5a)