1
0
Fork 0
forked from lthn/blockchain

coretests: count_ref_by_id_and_gindex_refs_for_tx_inputs added

This commit is contained in:
sowle 2021-01-08 02:22:29 +03:00
parent bf9195db58
commit 7cc220c8bd
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC

View file

@ -916,6 +916,26 @@ inline uint64_t get_sources_total_amount(const std::vector<currency::tx_source_e
return result;
}
inline void count_ref_by_id_and_gindex_refs_for_tx_inputs(const currency::transaction& tx, size_t& refs_by_id, size_t& refs_by_gindex)
{
refs_by_id = 0;
refs_by_gindex = 0;
for (auto& in : tx.vin)
{
if (in.type() != typeid(currency::txin_to_key))
continue;
const currency::txin_to_key& in2key = boost::get<currency::txin_to_key>(in);
for (auto& ko : in2key.key_offsets)
{
if (ko.type() == typeid(currency::ref_by_id))
++refs_by_id;
else if (ko.type() == typeid(uint64_t))
++refs_by_gindex;
}
}
}
template<typename U, typename V>
void append_vector_by_another_vector(U& dst, const V& src)
{