mirror of
https://github.com/monero-project/monero.git
synced 2026-08-02 00:47:53 -07:00
Merge pull request #9940
e9c89dc wallet: kill support for deprecated ephemeral Boost messages (jeffro256)
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
#include "common/command_line.h"
|
||||
#include "common/varint.h"
|
||||
#include "serialization/crypto.h"
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
#include "cryptonote_core/tx_pool.h"
|
||||
#include "cryptonote_core/cryptonote_core.h"
|
||||
#include "cryptonote_core/blockchain.h"
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include <boost/filesystem.hpp>
|
||||
#include "common/command_line.h"
|
||||
#include "common/varint.h"
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
#include "cryptonote_core/cryptonote_core.h"
|
||||
#include "blockchain_db/blockchain_db.h"
|
||||
#include "time_helper.h"
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
#include "cryptonote_core/blockchain.h"
|
||||
#include "blockchain_db/blockchain_db.h"
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "serialization/difficulty_type.h"
|
||||
|
||||
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include "tx_pool.h"
|
||||
#include "blockchain.h"
|
||||
#include "blockchain_db/blockchain_db.h"
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
#include "cryptonote_basic/events.h"
|
||||
#include "cryptonote_config.h"
|
||||
#include "cryptonote_basic/miner.h"
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
|
||||
#include "tx_pool.h"
|
||||
#include "cryptonote_tx_utils.h"
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
#include "cryptonote_basic/events.h"
|
||||
#include "cryptonote_config.h"
|
||||
#include "blockchain.h"
|
||||
|
||||
@@ -3031,11 +3031,8 @@ bool simple_wallet::set_load_deprecated_formats(const std::vector<std::string> &
|
||||
if (pwd_container)
|
||||
{
|
||||
parse_bool_and_use(args[1], [&](bool r) {
|
||||
m_wallet->load_deprecated_formats(r);
|
||||
m_wallet->rewrite(m_wallet_file, pwd_container->password());
|
||||
|
||||
if (r)
|
||||
message_writer() << tr("Warning: deprecated formats use boost serialization, which has buffer overflows and crashers. Only load deprecated formats from sources you trust.");
|
||||
fail_msg_writer() << tr("Warning: deprecated formats use boost serialization, which has buffer overflows and crashes. Support for them has been discontinued.");
|
||||
});
|
||||
}
|
||||
return true;
|
||||
@@ -3766,7 +3763,6 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
|
||||
<< " (disabled on Windows)"
|
||||
#endif
|
||||
;
|
||||
success_msg_writer() << "load-deprecated-formats = " << m_wallet->load_deprecated_formats();
|
||||
success_msg_writer() << "enable-multisig-experimental = " << m_wallet->is_multisig_enabled();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ void message_store::write_to_file(const multisig_wallet_state &state, const std:
|
||||
THROW_WALLET_EXCEPTION_IF(!success, tools::error::file_save_error, filename);
|
||||
}
|
||||
|
||||
void message_store::read_from_file(const multisig_wallet_state &state, const std::string &filename, bool load_deprecated_formats)
|
||||
void message_store::read_from_file(const multisig_wallet_state &state, const std::string &filename)
|
||||
{
|
||||
boost::system::error_code ignored_ec;
|
||||
bool file_exists = boost::filesystem::exists(filename, ignored_ec);
|
||||
@@ -793,22 +793,6 @@ void message_store::read_from_file(const multisig_wallet_state &state, const std
|
||||
loaded = true;
|
||||
}
|
||||
catch (...) {}
|
||||
if (!loaded && load_deprecated_formats)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::stringstream iss;
|
||||
iss << buf;
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> read_file_data;
|
||||
loaded = true;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
MERROR("MMS file " << filename << " has bad structure <iv,encrypted_data>: " << e.what());
|
||||
THROW_WALLET_EXCEPTION_IF(true, tools::error::file_read_error, filename);
|
||||
}
|
||||
}
|
||||
if (!loaded)
|
||||
{
|
||||
MERROR("MMS file " << filename << " has bad structure <iv,encrypted_data>");
|
||||
@@ -830,22 +814,6 @@ void message_store::read_from_file(const multisig_wallet_state &state, const std
|
||||
loaded = true;
|
||||
}
|
||||
catch(...) {}
|
||||
if (!loaded && load_deprecated_formats)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::stringstream iss;
|
||||
iss << decrypted_data;
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> *this;
|
||||
loaded = true;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
MERROR("MMS file " << filename << " has bad structure: " << e.what());
|
||||
THROW_WALLET_EXCEPTION_IF(true, tools::error::file_read_error, filename);
|
||||
}
|
||||
}
|
||||
if (!loaded)
|
||||
{
|
||||
MERROR("MMS file " << filename << " has bad structure");
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include <boost/program_options/options_description.hpp>
|
||||
#include <boost/optional/optional.hpp>
|
||||
#include "serialization/serialization.h"
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
#include "cryptonote_basic/account_boost_serialization.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "common/i18n.h"
|
||||
#include "common/command_line.h"
|
||||
@@ -352,7 +350,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, bool load_deprecated_formats = false);
|
||||
void read_from_file(const multisig_wallet_state &state, const std::string &filename);
|
||||
|
||||
template <class t_archive>
|
||||
inline void serialize(t_archive &a, const unsigned int ver)
|
||||
@@ -418,88 +416,3 @@ namespace mms
|
||||
void save(const multisig_wallet_state &state);
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_CLASS_VERSION(mms::file_data, 0)
|
||||
BOOST_CLASS_VERSION(mms::message_store, 0)
|
||||
BOOST_CLASS_VERSION(mms::message, 0)
|
||||
BOOST_CLASS_VERSION(mms::file_transport_message, 0)
|
||||
BOOST_CLASS_VERSION(mms::authorized_signer, 1)
|
||||
BOOST_CLASS_VERSION(mms::auto_config_data, 0)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, mms::file_data &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.magic_string;
|
||||
a & x.file_version;
|
||||
a & x.iv;
|
||||
a & x.encrypted_data;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, mms::message &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.id;
|
||||
a & x.type;
|
||||
a & x.direction;
|
||||
a & x.content;
|
||||
a & x.created;
|
||||
a & x.modified;
|
||||
a & x.sent;
|
||||
a & x.signer_index;
|
||||
a & x.hash;
|
||||
a & x.state;
|
||||
a & x.wallet_height;
|
||||
a & x.round;
|
||||
a & x.signature_count;
|
||||
a & x.transport_id;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, mms::authorized_signer &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.label;
|
||||
a & x.transport_address;
|
||||
a & x.monero_address_known;
|
||||
a & x.monero_address;
|
||||
a & x.me;
|
||||
a & x.index;
|
||||
if (ver < 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
a & x.auto_config_token;
|
||||
a & x.auto_config_public_key;
|
||||
a & x.auto_config_secret_key;
|
||||
a & x.auto_config_transport_address;
|
||||
a & x.auto_config_running;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, mms::auto_config_data &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.label;
|
||||
a & x.transport_address;
|
||||
a & x.monero_address;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, mms::file_transport_message &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.sender_address;
|
||||
a & x.iv;
|
||||
a & x.encryption_public_key;
|
||||
a & x.internal_message;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, crypto::chacha_iv &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@
|
||||
#pragma once
|
||||
#include "serialization/keyvalue_serialization.h"
|
||||
#include "cryptonote_basic/cryptonote_basic.h"
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
#include "cryptonote_basic/account_boost_serialization.h"
|
||||
#include "net/http_server_impl_base.h"
|
||||
#include "net/http_client.h"
|
||||
#include "net/abstract_http_client.h"
|
||||
|
||||
+2
-118
@@ -1250,7 +1250,6 @@ wallet2::wallet2(network_type nettype, uint64_t kdf_rounds, bool unattended, std
|
||||
m_offline(false),
|
||||
m_rpc_version(0),
|
||||
m_export_format(ExportFormat::Binary),
|
||||
m_load_deprecated_formats(false),
|
||||
m_enable_multisig(false),
|
||||
m_pool_info_query_time(0),
|
||||
m_has_ever_refreshed_from_node(false),
|
||||
@@ -4736,7 +4735,7 @@ boost::optional<wallet2::keys_file_data> wallet2::get_keys_file_data(const crypt
|
||||
value2.SetInt(m_export_format);
|
||||
json.AddMember("export_format", value2, json.GetAllocator());
|
||||
|
||||
value2.SetInt(m_load_deprecated_formats);
|
||||
value2.SetInt(false);
|
||||
json.AddMember("load_deprecated_formats", value2, json.GetAllocator());
|
||||
|
||||
value2.SetUint(1);
|
||||
@@ -5002,7 +5001,6 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
|
||||
m_subaddress_lookahead_minor = SUBADDRESS_LOOKAHEAD_MINOR;
|
||||
m_original_keys_available = false;
|
||||
m_export_format = ExportFormat::Binary;
|
||||
m_load_deprecated_formats = false;
|
||||
m_device_name = "";
|
||||
m_device_derivation_path = "";
|
||||
m_key_device_type = hw::device::device_type::SOFTWARE;
|
||||
@@ -5187,9 +5185,6 @@ bool wallet2::load_keys_buf(const std::string& keys_buf, const epee::wipeable_st
|
||||
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, export_format, ExportFormat, Int, false, Binary);
|
||||
m_export_format = field_export_format;
|
||||
|
||||
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, load_deprecated_formats, int, Int, false, false);
|
||||
m_load_deprecated_formats = field_load_deprecated_formats;
|
||||
|
||||
GET_FIELD_FROM_JSON_RETURN_ON_ERROR(json, device_name, std::string, String, false, std::string());
|
||||
if (m_device_name.empty())
|
||||
{
|
||||
@@ -6544,7 +6539,7 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass
|
||||
try
|
||||
{
|
||||
if (use_fs)
|
||||
m_message_store.read_from_file(get_multisig_wallet_state(), m_mms_file, m_load_deprecated_formats);
|
||||
m_message_store.read_from_file(get_multisig_wallet_state(), m_mms_file);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
@@ -7719,50 +7714,13 @@ bool wallet2::parse_unsigned_tx_from_str(const std::string &unsigned_tx_st, unsi
|
||||
s = s.substr(1);
|
||||
if (version == '\003')
|
||||
{
|
||||
if (!m_load_deprecated_formats)
|
||||
{
|
||||
LOG_PRINT_L0("Not loading deprecated format");
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
std::istringstream iss(s);
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> exported_txs;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_PRINT_L0("Failed to parse data from unsigned tx");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (version == '\004')
|
||||
{
|
||||
if (!m_load_deprecated_formats)
|
||||
{
|
||||
LOG_PRINT_L0("Not loading deprecated format");
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
s = decrypt_with_view_secret_key(s);
|
||||
try
|
||||
{
|
||||
std::istringstream iss(s);
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> exported_txs;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_PRINT_L0("Failed to parse data from unsigned tx");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
LOG_PRINT_L0("Failed to decrypt unsigned tx: " << e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (version == '\005')
|
||||
{
|
||||
@@ -8034,50 +7992,13 @@ bool wallet2::parse_tx_from_str(const std::string &signed_tx_st, std::vector<too
|
||||
s = s.substr(1);
|
||||
if (version == '\003')
|
||||
{
|
||||
if (!m_load_deprecated_formats)
|
||||
{
|
||||
LOG_PRINT_L0("Not loading deprecated format");
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
std::istringstream iss(s);
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> signed_txs;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_PRINT_L0("Failed to parse data from signed transaction");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (version == '\004')
|
||||
{
|
||||
if (!m_load_deprecated_formats)
|
||||
{
|
||||
LOG_PRINT_L0("Not loading deprecated format");
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
s = decrypt_with_view_secret_key(s);
|
||||
try
|
||||
{
|
||||
std::istringstream iss(s);
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> signed_txs;
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
LOG_PRINT_L0("Failed to parse decrypted data from signed transaction");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
LOG_PRINT_L0("Failed to decrypt signed transaction: " << e.what());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (version == '\005')
|
||||
{
|
||||
@@ -8229,17 +8150,6 @@ bool wallet2::parse_multisig_tx_from_str(std::string multisig_tx_st, multisig_tx
|
||||
loaded = true;
|
||||
}
|
||||
catch (...) {}
|
||||
try
|
||||
{
|
||||
if (!loaded && m_load_deprecated_formats)
|
||||
{
|
||||
std::istringstream iss(multisig_tx_st);
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> exported_txs;
|
||||
loaded = true;
|
||||
}
|
||||
}
|
||||
catch(...) {}
|
||||
|
||||
if (!loaded)
|
||||
{
|
||||
@@ -12805,12 +12715,6 @@ bool wallet2::check_reserve_proof(const cryptonote::account_public_address &addr
|
||||
loaded = true;
|
||||
}
|
||||
catch(...) {}
|
||||
if (!loaded && m_load_deprecated_formats)
|
||||
{
|
||||
std::istringstream iss(sig_decoded);
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> proofs >> subaddr_spendkeys;
|
||||
}
|
||||
|
||||
THROW_WALLET_EXCEPTION_IF(subaddr_spendkeys.count(address.m_spend_public_key) == 0, error::wallet_internal_error,
|
||||
"The given address isn't found in the proof");
|
||||
@@ -14533,19 +14437,6 @@ size_t wallet2::import_outputs_from_str(const std::string &outputs_st)
|
||||
}
|
||||
catch (...) {}
|
||||
|
||||
if (!loaded && m_load_deprecated_formats)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::stringstream iss;
|
||||
iss << body;
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> outputs;
|
||||
loaded = true;
|
||||
}
|
||||
catch (...) {}
|
||||
}
|
||||
|
||||
if (!loaded)
|
||||
{
|
||||
std::get<0>(outputs) = 0;
|
||||
@@ -14807,13 +14698,6 @@ size_t wallet2::import_multisig(std::vector<cryptonote::blobdata> blobs)
|
||||
loaded = true;
|
||||
}
|
||||
catch(...) {}
|
||||
if (!loaded && m_load_deprecated_formats)
|
||||
{
|
||||
std::istringstream iss(body);
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> i;
|
||||
loaded = true;
|
||||
}
|
||||
CHECK_AND_ASSERT_THROW_MES(loaded, "Failed to load output data");
|
||||
|
||||
for (const auto &e: i)
|
||||
|
||||
@@ -1488,8 +1488,6 @@ private:
|
||||
void device_derivation_path(const std::string &device_derivation_path) { m_device_derivation_path = device_derivation_path; }
|
||||
const ExportFormat & export_format() const { return m_export_format; }
|
||||
inline void set_export_format(const ExportFormat& export_format) { m_export_format = export_format; }
|
||||
bool load_deprecated_formats() const { return m_load_deprecated_formats; }
|
||||
void load_deprecated_formats(bool load) { m_load_deprecated_formats = load; }
|
||||
bool is_multisig_enabled() const { return m_enable_multisig; }
|
||||
void enable_multisig(bool enable) { m_enable_multisig = enable; }
|
||||
bool is_mismatched_daemon_version_allowed() const { return m_allow_mismatched_daemon_version; }
|
||||
@@ -2042,7 +2040,6 @@ private:
|
||||
std::unique_ptr<wallet_device_callback> m_device_callback;
|
||||
|
||||
ExportFormat m_export_format;
|
||||
bool m_load_deprecated_formats;
|
||||
|
||||
bool m_has_ever_refreshed_from_node;
|
||||
|
||||
@@ -2058,18 +2055,11 @@ BOOST_CLASS_VERSION(tools::wallet2, 31)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 12)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_info, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_info::LR, 0)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_tx_set, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::payment_details, 5)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::pool_payment_details, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::unconfirmed_transfer_details, 8)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::confirmed_transfer_details, 6)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::address_book_row, 18)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::reserve_proof_entry, 0)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::unsigned_tx_set, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::signed_tx_set, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::tx_construction_data, 4)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::pending_tx, 3)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::multisig_sig, 1)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::background_synced_tx_t, 0)
|
||||
BOOST_CLASS_VERSION(tools::wallet2::background_sync_data_t, 0)
|
||||
|
||||
@@ -2250,13 +2240,6 @@ namespace boost
|
||||
a & x.m_partial_key_images;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::multisig_tx_set &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.m_ptx;
|
||||
a & x.m_signers;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::unconfirmed_transfer_details &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
@@ -2433,144 +2416,6 @@ namespace boost
|
||||
a & x.m_payment_id;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive& a, tools::wallet2::reserve_proof_entry& x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.txid;
|
||||
a & x.index_in_tx;
|
||||
a & x.shared_secret;
|
||||
a & x.key_image;
|
||||
a & x.shared_secret_sig;
|
||||
a & x.key_image_sig;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::unsigned_tx_set &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.txes;
|
||||
if (ver == 0)
|
||||
{
|
||||
// load old version
|
||||
std::pair<size_t, tools::wallet2::transfer_container> old_transfers;
|
||||
a & old_transfers;
|
||||
std::get<0>(x.transfers) = std::get<0>(old_transfers);
|
||||
std::get<1>(x.transfers) = std::get<0>(old_transfers) + std::get<1>(old_transfers).size();
|
||||
std::get<2>(x.transfers) = std::get<1>(old_transfers);
|
||||
return;
|
||||
}
|
||||
throw std::runtime_error("Boost serialization not supported for newest unsigned_tx_set");
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::signed_tx_set &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.ptx;
|
||||
a & x.key_images;
|
||||
if (ver < 1)
|
||||
return;
|
||||
a & x.tx_key_images;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::tx_construction_data &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.sources;
|
||||
a & x.change_dts;
|
||||
a & x.splitted_dsts;
|
||||
if (ver < 2)
|
||||
{
|
||||
// load list to vector
|
||||
std::list<size_t> selected_transfers;
|
||||
a & selected_transfers;
|
||||
x.selected_transfers.clear();
|
||||
x.selected_transfers.reserve(selected_transfers.size());
|
||||
for (size_t t: selected_transfers)
|
||||
x.selected_transfers.push_back(t);
|
||||
}
|
||||
a & x.extra;
|
||||
a & x.unlock_time;
|
||||
a & x.use_rct;
|
||||
a & x.dests;
|
||||
if (ver < 1)
|
||||
{
|
||||
x.subaddr_account = 0;
|
||||
return;
|
||||
}
|
||||
a & x.subaddr_account;
|
||||
a & x.subaddr_indices;
|
||||
if (ver < 2)
|
||||
{
|
||||
if (!typename Archive::is_saving())
|
||||
x.rct_config = { rct::RangeProofBorromean, 0 };
|
||||
return;
|
||||
}
|
||||
a & x.selected_transfers;
|
||||
if (ver < 3)
|
||||
{
|
||||
if (!typename Archive::is_saving())
|
||||
x.rct_config = { rct::RangeProofBorromean, 0 };
|
||||
return;
|
||||
}
|
||||
if (ver < 4)
|
||||
{
|
||||
bool use_bulletproofs = x.rct_config.range_proof_type != rct::RangeProofBorromean;
|
||||
a & use_bulletproofs;
|
||||
if (!typename Archive::is_saving())
|
||||
x.rct_config = { use_bulletproofs ? rct::RangeProofPaddedBulletproof : rct::RangeProofBorromean, 0 };
|
||||
return;
|
||||
}
|
||||
a & x.rct_config;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::multisig_sig &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.sigs;
|
||||
a & x.ignore;
|
||||
a & x.used_L;
|
||||
a & x.signing_keys;
|
||||
a & x.msout;
|
||||
if (ver < 1)
|
||||
return;
|
||||
a & x.total_alpha_G;
|
||||
a & x.total_alpha_H;
|
||||
a & x.c_0;
|
||||
a & x.s;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive &a, tools::wallet2::pending_tx &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
a & x.tx;
|
||||
a & x.dust;
|
||||
a & x.fee;
|
||||
a & x.dust_added_to_fee;
|
||||
a & x.change_dts;
|
||||
if (ver < 2)
|
||||
{
|
||||
// load list to vector
|
||||
std::list<size_t> selected_transfers;
|
||||
a & selected_transfers;
|
||||
x.selected_transfers.clear();
|
||||
x.selected_transfers.reserve(selected_transfers.size());
|
||||
for (size_t t: selected_transfers)
|
||||
x.selected_transfers.push_back(t);
|
||||
}
|
||||
a & x.key_images;
|
||||
a & x.tx_key;
|
||||
a & x.dests;
|
||||
a & x.construction_data;
|
||||
if (ver < 1)
|
||||
return;
|
||||
a & x.additional_tx_keys;
|
||||
if (ver < 2)
|
||||
return;
|
||||
a & x.selected_transfers;
|
||||
if (ver < 3)
|
||||
return;
|
||||
a & x.multisig_sigs;
|
||||
}
|
||||
|
||||
template <class Archive>
|
||||
inline void serialize(Archive& a, tools::wallet2::background_synced_tx_t &x, const boost::serialization::version_type ver)
|
||||
{
|
||||
|
||||
@@ -1912,18 +1912,6 @@ namespace tools
|
||||
}
|
||||
catch(...) {}
|
||||
|
||||
if (!loaded && !m_restricted)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::istringstream iss(blob);
|
||||
boost::archive::portable_binary_iarchive ar(iss);
|
||||
ar >> ptx;
|
||||
loaded = true;
|
||||
}
|
||||
catch (...) {}
|
||||
}
|
||||
|
||||
if (!loaded)
|
||||
{
|
||||
er.code = WALLET_RPC_ERROR_CODE_BAD_TX_METADATA;
|
||||
|
||||
Reference in New Issue
Block a user