From 1bb0523b83547dc9277f5a0b6889d03a736892a3 Mon Sep 17 00:00:00 2001 From: sowle Date: Fri, 23 May 2025 05:32:33 +0300 Subject: [PATCH] get_out_pub_key_from_tx_out_v() implemented --- .../currency_format_utils_abstract.h | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) 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) {