1
0
Fork 0
forked from lthn/blockchain

fixed bugs in ado transition

This commit is contained in:
cryptozoidberg 2024-10-21 19:51:31 +04:00
parent 42b5f32116
commit aeb313a72c
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D
2 changed files with 6 additions and 17 deletions

View file

@ -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<crypto::public_key> 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;
}

View file

@ -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)