1
0
Fork 0
forked from lthn/blockchain

added isolated items to rpc-structures

This commit is contained in:
cryptozoidberg 2021-06-24 22:10:09 +02:00
parent 42712aa8d7
commit faa956a959
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
3 changed files with 29 additions and 8 deletions

View file

@ -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<tx_payer, tx_payer_old>(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<uint32_t>(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<cr
case GUI_TX_TYPE_PUSH_OFFER:
{
bc_services::offer_details od;
if (!get_type_in_variant_container(m_transfer_history[i].srv_attachments, od))
if (!get_type_in_variant_container(m_transfer_history[i].marketplace_entries, od))
{
WLT_LOG_ERROR("Transaction history entry " << i << " market as type " << m_transfer_history[i].tx_type << " but get_type_in_variant_container returned false for bc_services::offer_details");
break;
@ -4591,7 +4596,7 @@ bool wallet2::extract_offers_from_transfer_entry(size_t i, std::unordered_map<cr
case GUI_TX_TYPE_UPDATE_OFFER:
{
bc_services::update_offer uo;
if (!get_type_in_variant_container(m_transfer_history[i].srv_attachments, uo))
if (!get_type_in_variant_container(m_transfer_history[i].marketplace_entries, uo))
{
WLT_LOG_ERROR("Transaction history entry " << i << " market as type " << m_transfer_history[i].tx_type << " but get_type_in_variant_container returned false for update_offer");
break;
@ -4623,7 +4628,7 @@ bool wallet2::extract_offers_from_transfer_entry(size_t i, std::unordered_map<cr
case GUI_TX_TYPE_CANCEL_OFFER:
{
bc_services::cancel_offer co;
if (!get_type_in_variant_container(m_transfer_history[i].srv_attachments, co))
if (!get_type_in_variant_container(m_transfer_history[i].marketplace_entries, co))
{
WLT_LOG_ERROR("Transaction history entry " << i << " market as type " << m_transfer_history[i].tx_type << " but get_type_in_variant_container returned false for cancel_offer");
break;

View file

@ -1056,10 +1056,9 @@ private:
} // namespace tools
BOOST_CLASS_VERSION(tools::wallet2, WALLET_FILE_SERIALIZATION_VERSION)
BOOST_CLASS_VERSION(tools::wallet_public::wallet_transfer_info, 9)
BOOST_CLASS_VERSION(tools::wallet_public::wallet_transfer_info, 10)
BOOST_CLASS_VERSION(tools::wallet2::transfer_details, 3)
namespace boost
{
namespace serialization
@ -1141,8 +1140,11 @@ namespace boost
a & x.comment;
a & x.contract;
a & x.selected_indicies;
a & x.srv_attachments;
a & x.marketplace_entries;
a & x.unlock_time;
if (ver < 10)
return;
a & x.service_entries;
}
template <class Archive>

View file

@ -87,6 +87,17 @@ namespace wallet_public
#define WALLET_TRANSFER_INFO_FLAGS_HTLC_DEPOSIT static_cast<uint16_t>(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<tx_service_attachment_kv> service_entries;
//not included in streaming serialization
uint64_t fee;
bool show_sender;
std::vector<escrow_contract_details> contract;
uint16_t extra_flags;
//not included in kv serialization map
currency::transaction tx;
std::vector<uint64_t> selected_indicies;
std::list<bc_services::offers_attachment_t> srv_attachments;
std::list<bc_services::offers_attachment_t> 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()
};