diff options
author | jeffro256 <jeffro256@tutanota.com> | 2023-11-27 19:28:08 -0600 |
---|---|---|
committer | jeffro256 <jeffro256@tutanota.com> | 2023-11-28 14:06:24 -0600 |
commit | 2525200185e6b470c6e6cec3c3c8044a0eb0ecc0 (patch) | |
tree | a2548c11d8729e6e128ff5d1f2b6057bce4f2c1b /src/wallet/wallet2.cpp | |
parent | serialization: fix infinite loops and clean up dispatching (diff) | |
download | monero-2525200185e6b470c6e6cec3c3c8044a0eb0ecc0.tar.xz |
serialization: remove container wrappers and serialize directly
Some downstream code (most notably PR https://github.com/UkoeHB/monero/pull/25) wants to use the src/serialization lib
for storing information persistently. When one builds classes/machines wishing to serialize containers, they must use
the `serializable_*` container classes. In this case, this makes the Seraphis library code unnecessarily tightly coupled
with the src/serialization code since one cannot swap out their type of storage format without major refactoring of class
field types. By serializing STL containers directly, we can abstract the serialization details away, making for much
cleaner design. Also small bonus side effect of this change is that STL containers with custom Comparators, Allocators,
and Hashers are serializable. `std::multimap` is added to the list of serializable containers.
Depends upon https://github.com/monero-project/monero/pull/9069.
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 743a49ccb..dedb0343f 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -1821,7 +1821,7 @@ void reattach_blockchain(hashchain &blockchain, wallet2::detached_blockchain_dat } //---------------------------------------------------------------------------------------------------- bool has_nonrequested_tx_at_height_or_above_requested(uint64_t height, const std::unordered_set<crypto::hash> &requested_txids, const wallet2::transfer_container &transfers, - const wallet2::payment_container &payments, const serializable_unordered_map<crypto::hash, wallet2::confirmed_transfer_details> &confirmed_txs) + const wallet2::payment_container &payments, const std::unordered_map<crypto::hash, wallet2::confirmed_transfer_details> &confirmed_txs) { for (const auto &td : transfers) if (td.m_block_height >= height && requested_txids.find(td.m_txid) == requested_txids.end()) @@ -11985,7 +11985,7 @@ std::string wallet2::get_reserve_proof(const boost::optional<std::pair<uint32_t, } // collect all subaddress spend keys that received those outputs and generate their signatures - serializable_unordered_map<crypto::public_key, crypto::signature> subaddr_spendkeys; + std::unordered_map<crypto::public_key, crypto::signature> subaddr_spendkeys; for (const cryptonote::subaddress_index &index : subaddr_indices) { crypto::secret_key subaddr_spend_skey = m_account.get_keys().m_spend_secret_key; @@ -12030,7 +12030,7 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr bool loaded = false; std::vector<reserve_proof_entry> proofs; - serializable_unordered_map<crypto::public_key, crypto::signature> subaddr_spendkeys; + std::unordered_map<crypto::public_key, crypto::signature> subaddr_spendkeys; try { binary_archive<false> ar{epee::strspan<std::uint8_t>(sig_decoded)}; @@ -12044,7 +12044,7 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr { std::istringstream iss(sig_decoded); boost::archive::portable_binary_iarchive ar(iss); - ar >> proofs >> subaddr_spendkeys.parent(); + ar >> proofs >> subaddr_spendkeys; } THROW_WALLET_EXCEPTION_IF(subaddr_spendkeys.count(address.m_spend_public_key) == 0, error::wallet_internal_error, @@ -12288,7 +12288,7 @@ std::string wallet2::get_description() const return ""; } -const std::pair<serializable_map<std::string, std::string>, std::vector<std::string>>& wallet2::get_account_tags() +const std::pair<std::map<std::string, std::string>, std::vector<std::string>>& wallet2::get_account_tags() { // ensure consistency if (m_account_tags.second.size() != get_num_subaddress_accounts()) |