adding get_operation_history_id
This commit is contained in:
parent
19f0ec57f0
commit
7c3904bfae
2 changed files with 26 additions and 0 deletions
|
|
@ -68,6 +68,7 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
|
||||||
map<uint32_t, optional<block_header>> get_block_header_batch(const vector<uint32_t> block_nums)const;
|
map<uint32_t, optional<block_header>> get_block_header_batch(const vector<uint32_t> block_nums)const;
|
||||||
optional<signed_block> get_block(uint32_t block_num)const;
|
optional<signed_block> get_block(uint32_t block_num)const;
|
||||||
processed_transaction get_transaction( uint32_t block_num, uint32_t trx_in_block )const;
|
processed_transaction get_transaction( uint32_t block_num, uint32_t trx_in_block )const;
|
||||||
|
operation_history_id_type get_operation_history_id(uint32_t block_num, uint32_t trx_in_block, uint32_t op_in_trx)const;
|
||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
chain_property_object get_chain_properties()const;
|
chain_property_object get_chain_properties()const;
|
||||||
|
|
@ -410,6 +411,24 @@ processed_transaction database_api_impl::get_transaction(uint32_t block_num, uin
|
||||||
return opt_block->transactions[trx_num];
|
return opt_block->transactions[trx_num];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
operation_history_id_type database_api::get_operation_history_id(uint32_t block_num, uint32_t trx_in_block, uint32_t op_in_trx)const
|
||||||
|
{
|
||||||
|
return my->get_operation_history_id( block_num, trx_in_block, op_in_trx );
|
||||||
|
}
|
||||||
|
|
||||||
|
operation_history_id_type database_api_impl::get_operation_history_id(uint32_t block_num, uint32_t trx_in_block, uint32_t op_in_trx)const
|
||||||
|
{
|
||||||
|
const simple_index<operation_history_object>& op_index = _db.get_index_type<simple_index<operation_history_object>>();
|
||||||
|
|
||||||
|
for( const operation_history_object& op : op_index )
|
||||||
|
{
|
||||||
|
if(op.block_num == block_num and op.trx_in_block == trx_in_block and op.op_in_trx == op_in_trx) {
|
||||||
|
return op.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// Globals //
|
// Globals //
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,12 @@ class database_api
|
||||||
*/
|
*/
|
||||||
optional<signed_transaction> get_recent_transaction_by_id( const transaction_id_type& id )const;
|
optional<signed_transaction> get_recent_transaction_by_id( const transaction_id_type& id )const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a block, transaction in block position and operation position in transaction, get the operation_history_id
|
||||||
|
*/
|
||||||
|
operation_history_id_type get_operation_history_id(uint32_t block_num, uint32_t trx_in_block, uint32_t op_in_trx)const;
|
||||||
|
|
||||||
|
|
||||||
/////////////
|
/////////////
|
||||||
// Globals //
|
// Globals //
|
||||||
/////////////
|
/////////////
|
||||||
|
|
@ -600,6 +606,7 @@ FC_API(graphene::app::database_api,
|
||||||
(get_block)
|
(get_block)
|
||||||
(get_transaction)
|
(get_transaction)
|
||||||
(get_recent_transaction_by_id)
|
(get_recent_transaction_by_id)
|
||||||
|
(get_operation_history_id)
|
||||||
|
|
||||||
// Globals
|
// Globals
|
||||||
(get_chain_properties)
|
(get_chain_properties)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue