From 76577d21a9272a318c46377e62f15b7df4903bf2 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Tue, 31 Oct 2023 19:31:18 +0100 Subject: [PATCH] more fixes with namespaces and inline functions --- .../currency_format_utils_transactions.cpp | 11 ----------- .../currency_format_utils_transactions.h | 2 -- src/wallet/wallet2_base.h | 18 ++++++++++++++++-- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/currency_core/currency_format_utils_transactions.cpp b/src/currency_core/currency_format_utils_transactions.cpp index 7554aae5..d64ebd15 100644 --- a/src/currency_core/currency_format_utils_transactions.cpp +++ b/src/currency_core/currency_format_utils_transactions.cpp @@ -419,17 +419,6 @@ namespace currency THROW_IF_TRUE_WALLET_INT_ERR_EX_NO_HANDLER(false, "transform_str_to_tx shoruld never be called"); return currency::transaction(); } - //---------------------------------------------------------------------------------------------------- - const transaction_wallet_info& wallet2::transform_ptr_to_value(const std::shared_ptr& a) - { - return *a; - } - //---------------------------------------------------------------------------------------------------- - std::shared_ptr wallet2::transform_value_to_ptr(const transaction_wallet_info& d) - { - THROW_IF_TRUE_WALLET_INT_ERR_EX_NO_HANDLER(false, "transform_value_to_ptr shoruld never be called"); - return std::shared_ptr(); - } } \ No newline at end of file diff --git a/src/currency_core/currency_format_utils_transactions.h b/src/currency_core/currency_format_utils_transactions.h index 2944d755..2fc8beaf 100644 --- a/src/currency_core/currency_format_utils_transactions.h +++ b/src/currency_core/currency_format_utils_transactions.h @@ -331,8 +331,6 @@ namespace currency bool validate_tx_output_details_againt_tx_generation_context(const transaction& tx, const tx_generation_context& gen_context, const crypto::secret_key& onet_time_key); std::string transform_tx_to_str(const transaction& tx); transaction transform_str_to_tx(const std::string& tx_str); - const transaction_wallet_info& transform_ptr_to_value(const std::shared_ptr& a); - std::shared_ptr transform_value_to_ptr(const transaction_wallet_info& d); diff --git a/src/wallet/wallet2_base.h b/src/wallet/wallet2_base.h index 5f3e052f..8839c022 100644 --- a/src/wallet/wallet2_base.h +++ b/src/wallet/wallet2_base.h @@ -298,7 +298,7 @@ namespace tools BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(m_block_height) KV_SERIALIZE(m_block_timestamp) - KV_SERIALIZE_CUSTOM(m_tx, std::string, currency::wallet2::transform_tx_to_str, currency::transform_str_to_tx) + KV_SERIALIZE_CUSTOM(m_tx, std::string, currency::transform_tx_to_str, currency::transform_str_to_tx) END_KV_SERIALIZE_MAP() BEGIN_BOOST_SERIALIZATION() @@ -308,6 +308,20 @@ namespace tools END_BOOST_SERIALIZATION() }; + namespace detail + { + //---------------------------------------------------------------------------------------------------- + inline const transaction_wallet_info& transform_ptr_to_value(const std::shared_ptr& a) + { + return *a; + } + //---------------------------------------------------------------------------------------------------- + inline std::shared_ptr transform_value_to_ptr(const transaction_wallet_info& d) + { + THROW_IF_TRUE_WALLET_INT_ERR_EX_NO_HANDLER(false, "transform_value_to_ptr shoruld never be called"); + return std::shared_ptr(); + } + } struct transfer_details_base @@ -366,7 +380,7 @@ namespace tools } BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE_CUSTOM(m_ptx_wallet_info, const transaction_wallet_info&, currency::transform_ptr_to_value, currency::transform_value_to_ptr) + KV_SERIALIZE_CUSTOM(m_ptx_wallet_info, const transaction_wallet_info&, detail::transform_ptr_to_value, detail::transform_value_to_ptr) KV_SERIALIZE(m_internal_output_index) KV_SERIALIZE(m_spent_height) KV_SERIALIZE(m_flags)