1
0
Fork 0
forked from lthn/blockchain

more fixes with namespaces and inline functions

This commit is contained in:
cryptozoidberg 2023-10-31 19:31:18 +01:00
parent cacdb4a4ce
commit 76577d21a9
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
3 changed files with 16 additions and 15 deletions

View file

@ -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<transaction_wallet_info>& a)
{
return *a;
}
//----------------------------------------------------------------------------------------------------
std::shared_ptr<transaction_wallet_info> 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<transaction_wallet_info>();
}
}

View file

@ -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<transaction_wallet_info>& a);
std::shared_ptr<transaction_wallet_info> transform_value_to_ptr(const transaction_wallet_info& d);

View file

@ -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<transaction_wallet_info>& a)
{
return *a;
}
//----------------------------------------------------------------------------------------------------
inline std::shared_ptr<transaction_wallet_info> 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<transaction_wallet_info>();
}
}
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)