From aeb313a72c8e9fdf33bb0be3300a2d4a45e6a40f Mon Sep 17 00:00:00 2001 From: cryptozoidberg Date: Mon, 21 Oct 2024 19:51:31 +0400 Subject: [PATCH] fixed bugs in ado transition --- src/currency_core/currency_basic_backward_comp.inl | 10 +++++----- src/wallet/wallet2.cpp | 13 +------------ 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/currency_core/currency_basic_backward_comp.inl b/src/currency_core/currency_basic_backward_comp.inl index ef024377..9dc2a903 100644 --- a/src/currency_core/currency_basic_backward_comp.inl +++ b/src/currency_core/currency_basic_backward_comp.inl @@ -123,13 +123,13 @@ struct asset_descriptor_operation_v1 asset_descriptor_base descriptor; crypto::public_key amount_commitment = currency::null_pkey; // premultiplied by 1/8 boost::optional opt_asset_id; // target asset_id - for update/emit - uint8_t verion = 1; + uint8_t verion = ASSET_DESCRIPTOR_OPERATION_HF4_VER; - BEGIN_VERSIONED_SERIALIZE(1, verion) + BEGIN_SERIALIZE() FIELD(operation_type) FIELD(descriptor) FIELD(amount_commitment) - END_VERSION_UNDER(1) + //END_VERSION_UNDER(1) FIELD(opt_asset_id) END_SERIALIZE() @@ -139,7 +139,7 @@ struct asset_descriptor_operation_v1 BOOST_SERIALIZE(operation_type) BOOST_SERIALIZE(descriptor) BOOST_SERIALIZE(amount_commitment) - BOOST_END_VERSION_UNDER(1) + //BOOST_END_VERSION_UNDER(1) BOOST_SERIALIZE(opt_asset_id) END_BOOST_SERIALIZATION() }; @@ -183,7 +183,7 @@ bool transition_convert(const asset_descriptor_operation_v1& from, asset_descrip to.operation_type = from.operation_type; to.opt_descriptor = from.descriptor; to.opt_amount_commitment = from.amount_commitment; - to.opt_asset_id = to.opt_asset_id; // target asset_id - for update/emit + to.opt_asset_id = from.opt_asset_id; // target asset_id - for update/emit to.version = from.verion; return true; } \ No newline at end of file diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index 3b76a544..ce43b617 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -5640,18 +5640,7 @@ void wallet2::update_asset(const crypto::public_key& asset_id, const currency::a ctp.tx_meaning_for_logs = "asset eth update"; } - // old: - //this->transfer(ctp, ft, send_to_network, nullptr); - - //// test code -- TODO remove this -- sowle - this->transfer(ctp, ft, false, nullptr); - crypto::hash h1 = get_transaction_hash(ft.tx); - blobdata tx_blob = t_serializable_object_to_blob(ft.tx); - transaction tx{}; - parse_and_validate_tx_from_blob(tx_blob, tx); - crypto::hash h2 = get_transaction_hash(tx); - CHECK_AND_ASSERT_THROW_MES(h1 == h2, "h1 != h2"); - //// end of test code + this->transfer(ctp, ft, send_to_network, nullptr); } //---------------------------------------------------------------------------------------------------- void wallet2::update_asset(const crypto::public_key& asset_id, const currency::asset_descriptor_base new_descriptor, currency::transaction& result_tx)