1
0
Fork 0
forked from lthn/blockchain

has_field_of_type_in_extra() -> have_type_in_variant_container()

This commit is contained in:
sowle 2020-08-31 20:03:49 +03:00
parent 2dd0848b0a
commit bd894a0119
No known key found for this signature in database
GPG key ID: C07A24B2D89D49FC
2 changed files with 3 additions and 17 deletions

View file

@ -433,8 +433,7 @@ namespace currency
ai.m_alias = ard.alias;
return true;
}
//---------------------------------------------------------------
template<class extra_t>
extra_t& get_or_add_field_to_extra(std::vector<extra_v>& extra)
{
@ -446,6 +445,7 @@ namespace currency
extra.push_back(extra_t());
return boost::get<extra_t>(extra.back());
}
//---------------------------------------------------------------
template<class variant_t, class variant_type_t>
void update_or_add_field_to_extra(std::vector<variant_t>& variant_container, const variant_type_t& v)
{
@ -461,19 +461,6 @@ namespace currency
}
//---------------------------------------------------------------
template<class variant_type_t, class variant_t>
bool has_field_of_type_in_extra(std::vector<variant_t>& variant_container)
{
for (auto& ev : variant_container)
{
if (ev.type() == typeid(variant_type_t))
{
return true;
}
}
return false;
}
//---------------------------------------------------------------
template<class variant_type_t, class variant_t>
void remove_field_of_type_from_extra(std::vector<variant_t>& variant_container)
{
for (size_t i = 0; i != variant_container.size();)
@ -488,7 +475,6 @@ namespace currency
}
}
}
//---------------------------------------------------------------
template<typename t_container>
bool get_payment_id_from_tx(const t_container& att, std::string& payment_id)

View file

@ -1184,7 +1184,7 @@ void wallet2::prepare_wti(wallet_public::wallet_transfer_info& wti, uint64_t hei
decrypt_payload_items(decrypt_attachment_as_income, tx, m_account.get_keys(), decrypted_att);
if ((is_watch_only() && !wti.is_income)|| (height > 638000 && !has_field_of_type_in_extra<etc_tx_flags16_t>(decrypted_att)))
if ((is_watch_only() && !wti.is_income)|| (height > 638000 && !have_type_in_variant_container<etc_tx_flags16_t>(decrypted_att)))
{
remove_field_of_type_from_extra<tx_receiver_old>(decrypted_att);
remove_field_of_type_from_extra<tx_payer_old>(decrypted_att);