From 33b26a68c9230718f92fddbbf89747cebd5fd7d2 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Sat, 26 Jun 2021 02:40:41 +0200 Subject: [PATCH] bunch of fixes over isolate_auditable_and_proof test --- src/currency_core/currency_basic.h | 8 ++++++++ src/wallet/wallet2.cpp | 2 +- src/wallet/wallet_public_structs_defs.h | 13 +------------ tests/core_tests/isolate_auditable_and_proof.cpp | 12 +++++++----- 4 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/currency_core/currency_basic.h b/src/currency_core/currency_basic.h index 1193bd8a..7dd6a8cd 100644 --- a/src/currency_core/currency_basic.h +++ b/src/currency_core/currency_basic.h @@ -383,6 +383,14 @@ namespace currency FIELD(security) FIELD(flags) END_SERIALIZE() + + BEGIN_KV_SERIALIZE_MAP() + KV_SERIALIZE(service_id) + KV_SERIALIZE(instruction) + KV_SERIALIZE(body) + KV_SERIALIZE_CONTAINER_POD_AS_BLOB(security) + KV_SERIALIZE(flags) + END_KV_SERIALIZE_MAP() }; // applicable flags for tx_service_attachment::flags, can be combined using bitwise OR diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 2f6f0dd7..5b753b91 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -720,7 +720,7 @@ void wallet2::prepare_wti_decrypted_attachments(wallet_public::wallet_transfer_i { if (item.type() == typeid(currency::tx_service_attachment)) { - wti.service_entries.push_back(tools::wallet_public::tx_service_attachment_kv(boost::get(item))); + wti.service_entries.push_back(boost::get(item)); } } } diff --git a/src/wallet/wallet_public_structs_defs.h b/src/wallet/wallet_public_structs_defs.h index 02bc1973..3b78f2b4 100644 --- a/src/wallet/wallet_public_structs_defs.h +++ b/src/wallet/wallet_public_structs_defs.h @@ -87,17 +87,6 @@ namespace wallet_public #define WALLET_TRANSFER_INFO_FLAGS_HTLC_DEPOSIT static_cast(1 << 0) - struct tx_service_attachment_kv: public currency::tx_service_attachment - { - BEGIN_KV_SERIALIZE_MAP() - KV_SERIALIZE(service_id) - KV_SERIALIZE(instruction) - KV_SERIALIZE(body) - KV_SERIALIZE_CONTAINER_POD_AS_BLOB(security) - KV_SERIALIZE(flags) - END_KV_SERIALIZE_MAP() - }; - struct wallet_transfer_info { uint64_t amount; @@ -116,7 +105,7 @@ namespace wallet_public bool is_mining; uint64_t tx_type; wallet_transfer_info_details td; - std::vector service_entries; + std::vector service_entries; //not included in streaming serialization uint64_t fee; bool show_sender; diff --git a/tests/core_tests/isolate_auditable_and_proof.cpp b/tests/core_tests/isolate_auditable_and_proof.cpp index 2fb3fa69..b2907824 100644 --- a/tests/core_tests/isolate_auditable_and_proof.cpp +++ b/tests/core_tests/isolate_auditable_and_proof.cpp @@ -6,7 +6,9 @@ #include "escrow_wallet_tests.h" #include "random_helper.h" #include "chaingen_helpers.h" -#include "atomic_tests.h" +#include "isolate_auditable_and_proof.h" +#include "wallet/wrap_service.h" +#include "wallet/wallet_rpc_server.h" using namespace epee; using namespace crypto; @@ -77,7 +79,7 @@ bool isolate_auditable_and_proof::c1(currency::core& c, size_t ev_index, const s { std::vector extra; std::vector attachments; - vector dsts; + std::vector dsts; currency::tx_destination_entry de; de.addr.resize(1); @@ -104,11 +106,11 @@ bool isolate_auditable_and_proof::c1(currency::core& c, size_t ev_index, const s epee::json_rpc::error je; tools::wallet_rpc_server::connection_context ctx; tools::wallet_rpc_server miner_wlt_rpc(*auditable_test_instance); - wallet_public::COMMAND_RPC_GET_RECENT_TXS_AND_INFO::request req = AUTO_VAL_INIT(); - wallet_public::COMMAND_RPC_GET_RECENT_TXS_AND_INFO::request res = AUTO_VAL_INIT(); + tools::wallet_public::COMMAND_RPC_GET_RECENT_TXS_AND_INFO::request req = AUTO_VAL_INIT(req); + tools::wallet_public::COMMAND_RPC_GET_RECENT_TXS_AND_INFO::response res = AUTO_VAL_INIT(res); req.count = 100; req.offset = 0; - miner_wlt_rpc->on_get_recent_txs_and_info(req, res, je, ctx); + miner_wlt_rpc.on_get_recent_txs_and_info(req, res, je, ctx); std::string ps = epee::serialization::store_t_to_json(res); return r;