From f60b7209f8b2d1cb8e41c9480557c0243581c701 Mon Sep 17 00:00:00 2001 From: Some Random Crypto Guy Date: Thu, 9 Oct 2025 14:25:26 +0100 Subject: [PATCH] fixed wallet API regression on spend+view key access --- src/wallet/api/wallet.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp index 33f038406..b14955916 100644 --- a/src/wallet/api/wallet.cpp +++ b/src/wallet/api/wallet.cpp @@ -893,7 +893,8 @@ std::string WalletImpl::integratedAddress(const std::string &payment_id, bool ca std::string WalletImpl::secretViewKey() const { - if (m_wallet->use_fork_rules(HF_VERSION_CARROT, 0)) + uint32_t hf_version = m_wallet->estimate_current_hard_fork(); + if (hf_version >= HF_VERSION_CARROT) return epee::string_tools::pod_to_hex(unwrap(unwrap(m_wallet->get_account().get_keys().k_view_incoming))); else return epee::string_tools::pod_to_hex(unwrap(unwrap(m_wallet->get_account().get_keys().m_view_secret_key))); @@ -901,7 +902,8 @@ std::string WalletImpl::secretViewKey() const std::string WalletImpl::publicViewKey() const { - if (m_wallet->use_fork_rules(HF_VERSION_CARROT, 0)) + uint32_t hf_version = m_wallet->estimate_current_hard_fork(); + if (hf_version >= HF_VERSION_CARROT) return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.m_view_public_key); else return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_view_public_key); @@ -914,7 +916,8 @@ std::string WalletImpl::secretSpendKey() const std::string WalletImpl::publicSpendKey() const { - if (m_wallet->use_fork_rules(HF_VERSION_CARROT, 0)) + uint32_t hf_version = m_wallet->estimate_current_hard_fork(); + if (hf_version >= HF_VERSION_CARROT) return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_carrot_account_address.m_spend_public_key); else return epee::string_tools::pod_to_hex(m_wallet->get_account().get_keys().m_account_address.m_spend_public_key);