diff --git a/contrib/epee/include/serialization/keyvalue_serialization_overloads.h b/contrib/epee/include/serialization/keyvalue_serialization_overloads.h index d0d7c408..1bd2db1c 100644 --- a/contrib/epee/include/serialization/keyvalue_serialization_overloads.h +++ b/contrib/epee/include/serialization/keyvalue_serialization_overloads.h @@ -360,8 +360,12 @@ namespace epee template< class t_type_stored, class t_type, class t_storage, typename cb_serialize> static bool serialize_ephemeral(const t_type& d, t_storage& stg, typename t_storage::hsection hparent_section, const char* pname, cb_serialize cb_s) { - t_type_stored a = cb_s(d); - return epee::serialization::selector::serialize(a, stg, hparent_section, pname); + t_type_stored a = AUTO_VAL_INIT(a); + bool add_val = cb_s(d, a); + if (add_val) + return epee::serialization::selector::serialize(a, stg, hparent_section, pname); + else + return true; } }; diff --git a/src/wallet/wallet2_base.h b/src/wallet/wallet2_base.h index 4c88dc58..76fffc18 100644 --- a/src/wallet/wallet2_base.h +++ b/src/wallet/wallet2_base.h @@ -386,14 +386,16 @@ namespace tools return true; return false; } - static inline uint64_t transfer_details_base_to_amount(const transfer_details_base& tdb) + static inline bool transfer_details_base_to_amount(const transfer_details_base& tdb, uint64_t& val) { - return tdb.amount(); + val = tdb.amount(); + return true; } //---------------------------------------------------------------------------------------------------- - static inline std::string transfer_details_base_to_tx_hash(const transfer_details_base& tdb) + static inline bool transfer_details_base_to_tx_hash(const transfer_details_base& tdb, std::string& val) { - return epee::string_tools::pod_to_hex(currency::get_transaction_hash(tdb.m_ptx_wallet_info->m_tx)); + val = epee::string_tools::pod_to_hex(currency::get_transaction_hash(tdb.m_ptx_wallet_info->m_tx)); + return true; } diff --git a/src/wallet/wallet_public_structs_defs.h b/src/wallet/wallet_public_structs_defs.h index ba276a0a..e81aaa87 100644 --- a/src/wallet/wallet_public_structs_defs.h +++ b/src/wallet/wallet_public_structs_defs.h @@ -154,7 +154,6 @@ namespace wallet_public std::vector remote_addresses; //optional std::vector remote_aliases; //optional, describe only if there only one remote address std::vector subtransfers; - boost::optional data_for_external_signing; //not included in streaming serialization uint64_t fee = 0; @@ -191,6 +190,8 @@ namespace wallet_public KV_SERIALIZE(remote_addresses) DOC_DSCR("Remote addresses of this transfer(destination if it's outgoing transfer or sender if it's incoming transaction)") DOC_EXMP_AUTO(1, "ZxBvJDuQjMG9R2j4WnYUhBYNrwZPwuyXrC7FHdVmWqaESgowDvgfWtiXeNGu8Px9B24pkmjsA39fzSSiEQG1ekB225ZnrMTBp") DOC_END KV_SERIALIZE(remote_aliases) DOC_DSCR("Aliases for remot addresses, of discovered") DOC_EXMP_AUTO(1, "roger") DOC_END KV_SERIALIZE(subtransfers) DOC_DSCR("Essential part of transfer entry: amounts that been transfered in this transaction grouped by asset id") DOC_EXMP_AUTO(1) DOC_END + + KV_SERIALIZE_EPHEMERAL_N(currency::asset_descriptor_operation, wallet_transfer_info_get_ado, "ado") DOC_DSCR("\"Asset Descriptor Operation\" if it was present in transaction") DOC_END END_KV_SERIALIZE_MAP() BEGIN_BOOST_SERIALIZATION() @@ -277,6 +278,13 @@ namespace wallet_public subtransfers.back().is_income = true; return subtransfers.back().amount; } + static inline bool wallet_transfer_info_get_ado(const wallet_transfer_info& tdb, currency::asset_descriptor_operation& val) + { + if (currency::get_type_in_variant_container(tdb.tx.extra, val)) + return true; + + return false; + } }; struct wallet_transfer_info_old : public wallet_transfer_info @@ -291,14 +299,16 @@ namespace wallet_public KV_CHAIN_BASE(wallet_transfer_info) END_KV_SERIALIZE_MAP() - static uint64_t wallet_transfer_info_to_amount(const wallet_transfer_info_old& wtio) + static bool wallet_transfer_info_to_amount(const wallet_transfer_info_old& wtio, uint64_t &val) { - return wtio.get_native_amount(); + val = wtio.get_native_amount(); + return true; } - static bool wallet_transfer_info_to_is_income(const wallet_transfer_info_old& wtio) + static bool wallet_transfer_info_to_is_income(const wallet_transfer_info_old& wtio, bool& val) { - return wtio.get_native_is_income(); + val = wtio.get_native_is_income(); + return true; } };