Compare commits
6 commits
master
...
feature/GR
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
96aecc4870 | ||
|
|
640bda75ee | ||
|
|
0524c0c216 | ||
|
|
6743860f42 | ||
|
|
fa5d3eccdf | ||
|
|
654e998d89 |
2 changed files with 32 additions and 2 deletions
|
|
@ -184,6 +184,9 @@ class database_api_impl : public std::enable_shared_from_this<database_api_impl>
|
||||||
// gpos
|
// gpos
|
||||||
gpos_info get_gpos_info(const account_id_type account) const;
|
gpos_info get_gpos_info(const account_id_type account) const;
|
||||||
|
|
||||||
|
// rng
|
||||||
|
int64_t get_random_number(uint64_t bound) const;
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
const account_object* get_account_from_string( const std::string& name_or_id,
|
const account_object* get_account_from_string( const std::string& name_or_id,
|
||||||
bool throw_if_not_found = true ) const;
|
bool throw_if_not_found = true ) const;
|
||||||
|
|
@ -2303,6 +2306,22 @@ graphene::app::gpos_info database_api_impl::get_gpos_info(const account_id_type
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
// //
|
||||||
|
// Random numbers //
|
||||||
|
// //
|
||||||
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
int64_t database_api::get_random_number(uint64_t bound) const
|
||||||
|
{
|
||||||
|
return my->get_random_number(bound);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t database_api_impl::get_random_number(uint64_t bound) const {
|
||||||
|
int64_t result = _db.get_random_bits(bound);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// //
|
// //
|
||||||
// Private methods //
|
// Private methods //
|
||||||
|
|
|
||||||
|
|
@ -709,9 +709,17 @@ class database_api
|
||||||
*/
|
*/
|
||||||
gpos_info get_gpos_info(const account_id_type account) const;
|
gpos_info get_gpos_info(const account_id_type account) const;
|
||||||
|
|
||||||
|
/////////////////////////////
|
||||||
|
// Random number generator //
|
||||||
|
/////////////////////////////
|
||||||
|
/**
|
||||||
|
* @brief Returns the random number
|
||||||
|
* @param bound Upper bound of segment containing random number
|
||||||
|
* @return Random number from segment [0, bound)
|
||||||
|
*/
|
||||||
|
int64_t get_random_number(uint64_t bound) const;
|
||||||
|
|
||||||
|
private:
|
||||||
private:
|
|
||||||
std::shared_ptr< database_api_impl > my;
|
std::shared_ptr< database_api_impl > my;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -848,4 +856,7 @@ FC_API(graphene::app::database_api,
|
||||||
|
|
||||||
// gpos
|
// gpos
|
||||||
(get_gpos_info)
|
(get_gpos_info)
|
||||||
|
|
||||||
|
// rngs
|
||||||
|
(get_random_number)
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue