From bafd37aea4562fab7911e9cc719a59241b45f93f Mon Sep 17 00:00:00 2001 From: woodser Date: Sat, 11 Feb 2023 12:57:35 -0500 Subject: [PATCH] support outputs of type txout_to_key or txout_to_tagged_key --- src/utils/monero_utils.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/monero_utils.cpp b/src/utils/monero_utils.cpp index 98cc18c8..7ec26e2d 100644 --- a/src/utils/monero_utils.cpp +++ b/src/utils/monero_utils.cpp @@ -350,7 +350,16 @@ std::shared_ptr monero_utils::cn_tx_to_tx(const cryptonote::transacti output->m_tx = tx; tx->m_outputs.push_back(output); output->m_amount = cnVout.amount; - const crypto::public_key& cnStealthPublicKey = boost::get(cnVout.target).key; + + // before HF_VERSION_VIEW_TAGS, outputs with public keys are of type txout_to_key + // after HF_VERSION_VIEW_TAGS, outputs with public keys are of type txout_to_tagged_key + crypto::public_key cnStealthPublicKey; + if (cnVout.target.type() == typeid(txout_to_key)) + cnStealthPublicKey = boost::get(cnVout.target).key; + else if (cnVout.target.type() == typeid(txout_to_tagged_key)) + cnStealthPublicKey = boost::get(cnVout.target).key; + else + throw std::runtime_error(std::string("Unexpected output target type found: ") + std::string(cnVout.target.type().name())); output->m_stealth_public_key = epee::string_tools::pod_to_hex(cnStealthPublicKey); }