diff --git a/src/currency_core/currency_format_utils_abstract.h b/src/currency_core/currency_format_utils_abstract.h index b0f915d1..ad3d2b55 100644 --- a/src/currency_core/currency_format_utils_abstract.h +++ b/src/currency_core/currency_format_utils_abstract.h @@ -285,6 +285,35 @@ namespace currency return false; } //--------------------------------------------------------------- + inline + bool get_out_pub_key_from_tx_out_v(const tx_out_v& out_v, crypto::public_key& result) noexcept + { + try + { + if (out_v.type() == typeid(tx_out_bare)) + { + const txout_target_v& target_v = boost::get(out_v).target; + if (target_v.type() == typeid(txout_to_key)) + { + result = boost::get(target_v).key; + return true; + } + } + + if (out_v.type() == typeid(tx_out_zarcanum)) + { + result = boost::get(out_v).stealth_address; + return true; + } + } + catch(...) + { + // should never go here, just precaution + } + + return false; + } + //--------------------------------------------------------------- //, txin_htlc, txin_zc_input inline bool compare_variant_by_types(const txin_multisig& left, const txin_multisig& right) {