aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/message_store.h
diff options
context:
space:
mode:
authorAlexander Blair <snipa@jagtech.io>2020-08-27 02:54:29 -0700
committerAlexander Blair <snipa@jagtech.io>2020-08-27 02:54:30 -0700
commitbad5d8d6f05826ff1275c0ece08f3b99f6f39840 (patch)
treea9223c5c27a6e27535120e10cf49e9f5f17c2014 /src/wallet/message_store.h
parentMerge pull request #6660 (diff)
parentreplace most boost serialization with existing monero serialization (diff)
downloadmonero-bad5d8d6f05826ff1275c0ece08f3b99f6f39840.tar.xz
Merge pull request #6690
7175dcb10 replace most boost serialization with existing monero serialization (moneromooo-monero)
Diffstat (limited to 'src/wallet/message_store.h')
-rw-r--r--src/wallet/message_store.h77
1 files changed, 76 insertions, 1 deletions
diff --git a/src/wallet/message_store.h b/src/wallet/message_store.h
index 9055fd776..0f53587d4 100644
--- a/src/wallet/message_store.h
+++ b/src/wallet/message_store.h
@@ -44,6 +44,9 @@
#include "common/command_line.h"
#include "wipeable_string.h"
#include "net/abstract_http_client.h"
+#include "serialization/crypto.h"
+#include "serialization/string.h"
+#include "serialization/containers.h"
#include "message_transporter.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -112,6 +115,24 @@ namespace mms
uint32_t round;
uint32_t signature_count;
std::string transport_id;
+
+ BEGIN_SERIALIZE_OBJECT()
+ VERSION_FIELD(0)
+ VARINT_FIELD(id)
+ VARINT_FIELD(type)
+ VARINT_FIELD(direction)
+ FIELD(content)
+ VARINT_FIELD(created)
+ VARINT_FIELD(modified)
+ VARINT_FIELD(sent)
+ VARINT_FIELD(signer_index)
+ FIELD(hash)
+ VARINT_FIELD(state)
+ VARINT_FIELD(wallet_height)
+ VARINT_FIELD(round)
+ VARINT_FIELD(signature_count)
+ FIELD(transport_id)
+ END_SERIALIZE()
};
// "wallet_height" (for lack of a short name that would describe what it is about)
// is the number of transfers present in the wallet at the time of message
@@ -132,6 +153,21 @@ namespace mms
std::string auto_config_transport_address;
bool auto_config_running;
+ BEGIN_SERIALIZE_OBJECT()
+ VERSION_FIELD(0)
+ FIELD(label)
+ FIELD(transport_address)
+ FIELD(monero_address_known)
+ FIELD(monero_address)
+ FIELD(me)
+ VARINT_FIELD(index)
+ FIELD(auto_config_token)
+ FIELD(auto_config_public_key)
+ FIELD(auto_config_secret_key)
+ FIELD(auto_config_transport_address)
+ FIELD(auto_config_running)
+ END_SERIALIZE()
+
authorized_signer()
{
monero_address_known = false;
@@ -164,6 +200,13 @@ namespace mms
std::string label;
std::string transport_address;
cryptonote::account_public_address monero_address;
+
+ BEGIN_SERIALIZE_OBJECT()
+ VERSION_FIELD(0)
+ FIELD(label)
+ FIELD(transport_address)
+ FIELD(monero_address)
+ END_SERIALIZE()
};
// Overal .mms file structure, with the "message_store" object serialized to and
@@ -174,6 +217,13 @@ namespace mms
uint32_t file_version;
crypto::chacha_iv iv;
std::string encrypted_data;
+
+ BEGIN_SERIALIZE_OBJECT()
+ FIELD(magic_string)
+ FIELD(file_version)
+ FIELD(iv)
+ FIELD(encrypted_data)
+ END_SERIALIZE()
};
// The following struct provides info about the current state of a "wallet2" object
@@ -198,6 +248,19 @@ namespace mms
uint32_t multisig_rounds_passed;
size_t num_transfer_details;
std::string mms_file;
+
+ BEGIN_SERIALIZE_OBJECT()
+ VERSION_FIELD(0)
+ FIELD(address)
+ VARINT_FIELD(nettype)
+ FIELD(view_secret_key)
+ FIELD(multisig)
+ FIELD(multisig_is_ready)
+ FIELD(has_multisig_partial_key_images)
+ VARINT_FIELD(multisig_rounds_passed)
+ VARINT_FIELD(num_transfer_details)
+ FIELD(mms_file)
+ END_SERIALIZE()
};
class message_store
@@ -283,7 +346,7 @@ namespace mms
void stop() { m_run.store(false, std::memory_order_relaxed); m_transporter.stop(); }
void write_to_file(const multisig_wallet_state &state, const std::string &filename);
- void read_from_file(const multisig_wallet_state &state, const std::string &filename);
+ void read_from_file(const multisig_wallet_state &state, const std::string &filename, bool load_deprecated_formats = false);
template <class t_archive>
inline void serialize(t_archive &a, const unsigned int ver)
@@ -298,6 +361,18 @@ namespace mms
a & m_auto_send;
}
+ BEGIN_SERIALIZE_OBJECT()
+ VERSION_FIELD(0)
+ FIELD(m_active)
+ VARINT_FIELD(m_num_authorized_signers)
+ VARINT_FIELD(m_nettype)
+ VARINT_FIELD(m_num_required_signers)
+ FIELD(m_signers)
+ FIELD(m_messages)
+ VARINT_FIELD(m_next_message_id)
+ FIELD(m_auto_send)
+ END_SERIALIZE()
+
static const char* message_type_to_string(message_type type);
static const char* message_direction_to_string(message_direction direction);
static const char* message_state_to_string(message_state state);