added get_account_transaction_history_id and some fixes
This commit is contained in:
parent
7c3904bfae
commit
615321cc18
2 changed files with 25 additions and 0 deletions
|
|
@ -69,6 +69,7 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
|
|||
optional<signed_block> get_block(uint32_t block_num)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;
|
||||
account_transaction_history_id_type get_account_transaction_history_id(operation_history_id_type operation_id)const;
|
||||
|
||||
// Globals
|
||||
chain_property_object get_chain_properties()const;
|
||||
|
|
@ -424,6 +425,25 @@ operation_history_id_type database_api_impl::get_operation_history_id(uint32_t b
|
|||
{
|
||||
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;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
account_transaction_history_id_type database_api::get_account_transaction_history_id(operation_history_id_type operation_id)const
|
||||
{
|
||||
return my->get_account_transaction_history_id( operation_id );
|
||||
}
|
||||
|
||||
account_transaction_history_id_type database_api_impl::get_account_transaction_history_id(operation_history_id_type operation_id)const
|
||||
{
|
||||
const auto& ath_idx = _db.get_index_type<account_transaction_history_index>();
|
||||
const auto& ath_by_seq_idx = ath_idx.indices().get<by_seq>();
|
||||
|
||||
for( const account_transaction_history_object& ath : ath_by_seq_idx )
|
||||
{
|
||||
if(ath.operation_id == operation_id) {
|
||||
return ath.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -190,6 +190,10 @@ class database_api
|
|||
*/
|
||||
operation_history_id_type get_operation_history_id(uint32_t block_num, uint32_t trx_in_block, uint32_t op_in_trx)const;
|
||||
|
||||
/**
|
||||
* Given a operation_history_id, get the account_transaction_history_id
|
||||
*/
|
||||
account_transaction_history_id_type get_account_transaction_history_id(operation_history_id_type operation_id)const;
|
||||
|
||||
/////////////
|
||||
// Globals //
|
||||
|
|
@ -607,6 +611,7 @@ FC_API(graphene::app::database_api,
|
|||
(get_transaction)
|
||||
(get_recent_transaction_by_id)
|
||||
(get_operation_history_id)
|
||||
(get_account_transaction_history_id)
|
||||
|
||||
// Globals
|
||||
(get_chain_properties)
|
||||
|
|
|
|||
Loading…
Reference in a new issue