forked from lthn/blockchain
Merge branch 'auditability' into predevelop
This commit is contained in:
commit
64223405bb
2 changed files with 35 additions and 8 deletions
|
|
@ -68,12 +68,12 @@ namespace currency
|
|||
return t_unserializable_object_from_blob(b, b_blob);
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
template<typename specic_type_t, typename variant_t_container>
|
||||
template<typename specific_type_t, typename variant_t_container>
|
||||
bool have_type_in_variant_container(const variant_t_container& av)
|
||||
{
|
||||
for (auto& ai : av)
|
||||
{
|
||||
if (ai.type() == typeid(specic_type_t))
|
||||
if (ai.type() == typeid(specific_type_t))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -81,32 +81,54 @@ namespace currency
|
|||
return false;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
template<typename specic_type_t, typename variant_t_container>
|
||||
template<typename specific_type_t, typename variant_t_container>
|
||||
size_t count_type_in_variant_container(const variant_t_container& av)
|
||||
{
|
||||
size_t result = 0;
|
||||
for (auto& ai : av)
|
||||
{
|
||||
if (ai.type() == typeid(specic_type_t))
|
||||
if (ai.type() == typeid(specific_type_t))
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
template<typename specic_type_t, typename variant_t_container>
|
||||
bool get_type_in_variant_container(const variant_t_container& av, specic_type_t& a)
|
||||
template<typename specific_type_t, typename variant_t_container>
|
||||
bool get_type_in_variant_container(const variant_t_container& av, specific_type_t& a)
|
||||
{
|
||||
for (auto& ai : av)
|
||||
{
|
||||
if (ai.type() == typeid(specic_type_t))
|
||||
if (ai.type() == typeid(specific_type_t))
|
||||
{
|
||||
a = boost::get<specic_type_t>(ai);
|
||||
a = boost::get<specific_type_t>(ai);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
template <typename A, typename B, typename container_t, typename callback_t>
|
||||
bool handle_2_alternative_types_in_variant_container(const container_t& container, callback_t& cb)
|
||||
{
|
||||
bool found = false;
|
||||
for (auto& item : container)
|
||||
{
|
||||
if (item.type() == typeid(A))
|
||||
{
|
||||
found = true;
|
||||
if (!cb(boost::get<A>(item)))
|
||||
break;
|
||||
}
|
||||
else if (item.type() == typeid(B))
|
||||
{
|
||||
found = true;
|
||||
if (!cb(boost::get<A>(item)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
//---------------------------------------------------------------
|
||||
template<typename variant_container_t>
|
||||
bool check_allowed_types_in_variant_container(const variant_container_t& container, const std::unordered_set<std::type_index>& allowed_types, bool elements_must_be_unique = true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -633,6 +633,8 @@ namespace tools
|
|||
|
||||
bool get_transfer_address(const std::string& adr_str, currency::account_public_address& addr, std::string& payment_id);
|
||||
uint64_t get_blockchain_current_height() const { return m_blockchain.size(); }
|
||||
|
||||
uint64_t get_top_block_height() const { return m_blockchain.empty() ? 0 : m_blockchain.size() - 1; }
|
||||
|
||||
template <class t_archive>
|
||||
inline void serialize(t_archive &a, const unsigned int ver)
|
||||
|
|
@ -751,7 +753,10 @@ namespace tools
|
|||
static uint64_t get_max_unlock_time_from_receive_indices(const currency::transaction& tx, const money_transfer2_details& td);
|
||||
bool get_utxo_distribution(std::map<uint64_t, uint64_t>& distribution);
|
||||
uint64_t get_sync_progress();
|
||||
|
||||
|
||||
private:
|
||||
|
||||
void add_transfers_to_expiration_list(const std::vector<uint64_t>& selected_transfers, uint64_t expiration, uint64_t change_amount, const crypto::hash& related_tx_id);
|
||||
void remove_transfer_from_expiration_list(uint64_t transfer_index);
|
||||
void load_keys(const std::string& keys_file_name, const std::string& password);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue