From faa956a95927e25a2d72921c94163e2e12b1e602 Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Thu, 24 Jun 2021 22:10:09 +0200 Subject: [PATCH] added isolated items to rpc-structures --- src/wallet/wallet2.cpp | 13 +++++++++---- src/wallet/wallet2.h | 8 +++++--- src/wallet/wallet_public_structs_defs.h | 16 +++++++++++++++- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index d0456a00..b6c054a8 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -715,6 +715,11 @@ void wallet2::prepare_wti_decrypted_attachments(wallet_public::wallet_transfer_i wti.show_sender = handle_2_alternative_types_in_variant_container(decrypted_att, [&](const tx_payer& p) { sender_address = p.acc_addr; return false; /* <- continue? */ } ); if (wti.show_sender) wti.remote_addresses.push_back(currency::get_account_address_as_str(sender_address)); + + for (const auto& item : decrypted_att) + { + wti.service_entries.push_back(item); + } } else { @@ -1238,7 +1243,7 @@ void wallet2::prepare_wti(wallet_public::wallet_transfer_info& wti, uint64_t hei wti.tx_blob_size = static_cast(currency::get_object_blobsize(wti.tx)); wti.tx_hash = currency::get_transaction_hash(tx); load_wallet_transfer_info_flags(wti); - bc_services::extract_market_instructions(wti.srv_attachments, tx.attachment); + bc_services::extract_market_instructions(wti.marketplace_entries, tx.attachment); // escrow transactions, which are built with TX_FLAG_SIGNATURE_MODE_SEPARATE flag actually encrypt attachments // with buyer as a sender, and seller as receiver, despite the fact that for both sides transaction seen as outgoing @@ -4570,7 +4575,7 @@ bool wallet2::extract_offers_from_transfer_entry(size_t i, std::unordered_map diff --git a/src/wallet/wallet_public_structs_defs.h b/src/wallet/wallet_public_structs_defs.h index afcddc49..d9edd8ab 100644 --- a/src/wallet/wallet_public_structs_defs.h +++ b/src/wallet/wallet_public_structs_defs.h @@ -87,6 +87,17 @@ namespace wallet_public #define WALLET_TRANSFER_INFO_FLAGS_HTLC_DEPOSIT static_cast(1 << 0) + struct tx_service_attachment_kv: public 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; @@ -105,16 +116,18 @@ namespace wallet_public bool is_mining; uint64_t tx_type; wallet_transfer_info_details td; + std::vector service_entries; //not included in streaming serialization uint64_t fee; bool show_sender; std::vector contract; uint16_t extra_flags; + //not included in kv serialization map currency::transaction tx; std::vector selected_indicies; - std::list srv_attachments; + std::list marketplace_entries; BEGIN_KV_SERIALIZE_MAP() KV_SERIALIZE(amount) @@ -136,6 +149,7 @@ namespace wallet_public KV_SERIALIZE(tx_type) KV_SERIALIZE(show_sender) KV_SERIALIZE(contract) + KV_SERIALIZE(service_entries) END_KV_SERIALIZE_MAP() };