1
0
Fork 0
forked from lthn/blockchain

construc_tx compilation fixed

This commit is contained in:
cryptozoidberg 2024-10-19 21:33:42 +04:00
parent 844e5b823f
commit f3618e6418
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D
5 changed files with 32 additions and 6 deletions

View file

@ -696,6 +696,7 @@ namespace currency
}
};
#define ASSET_DESCRIPTOR_BASE_HF5_VER 2
#define ASSET_DESCRIPTOR_BASE_LAST_VER 2
struct dummy

View file

@ -2302,8 +2302,17 @@ namespace currency
amount_of_burned_assets -= item.amount;
}
}
ado.opt_amount = amount_of_burned_assets; // TODO: support hidden supply -- sowle
if (ado.version < ASSET_DESCRIPTOR_BASE_HF5_VER)
{
CHECK_AND_ASSERT_THROW_MES(ado.opt_descriptor.has_value(), "Internal error: opt_descriptor unset during ASSET_DESCRIPTOR_OPERATION_PUBLIC_BURN for version less then 2");
ado.opt_descriptor->current_supply -= amount_of_burned_assets;
}
else
{
CHECK_AND_ASSERT_THROW_MES(!ado.opt_descriptor.has_value(), "Internal error: opt_descriptor unset during ASSET_DESCRIPTOR_OPERATION_PUBLIC_BURN for version less then 2");
ado.opt_amount = amount_of_burned_assets; // TODO: support hidden supply -- sowle
}
gen_context.ao_amount_commitment = amount_of_burned_assets * gen_context.ao_asset_id_pt + gen_context.ao_amount_blinding_mask * crypto::c_point_G;
ado.opt_amount_commitment = (crypto::c_scalar_1div8 * gen_context.ao_amount_commitment).to_public_key();
@ -2329,7 +2338,16 @@ namespace currency
item.asset_id = gen_context.ao_asset_id;
}
}
ado.opt_amount = amount_of_emitted_asset; // TODO: support hidden supply -- sowle
if (ado.version < ASSET_DESCRIPTOR_BASE_HF5_VER)
{
CHECK_AND_ASSERT_THROW_MES(ado.opt_descriptor.has_value(), "Internal error: opt_descriptor unset during ASSET_DESCRIPTOR_OPERATION_PUBLIC_BURN for version less then 2");
ado.opt_descriptor->current_supply += amount_of_emitted_asset;
}
else
{
CHECK_AND_ASSERT_THROW_MES(!ado.opt_descriptor.has_value(), "Internal error: opt_descriptor unset during ASSET_DESCRIPTOR_OPERATION_PUBLIC_BURN for version less then 2");
ado.opt_amount = amount_of_emitted_asset; // TODO: support hidden supply -- sowle
}
gen_context.ao_amount_commitment = amount_of_emitted_asset * gen_context.ao_asset_id_pt + gen_context.ao_amount_blinding_mask * crypto::c_point_G;
ado.opt_amount_commitment = (crypto::c_scalar_1div8 * gen_context.ao_amount_commitment).to_public_key();
@ -2778,8 +2796,7 @@ namespace currency
const asset_descriptor_operation* pado = get_type_in_variant_container<asset_descriptor_operation>(tx.extra);
if (pado != nullptr)
{
if ((pado->operation_type == ASSET_DESCRIPTOR_OPERATION_EMIT || pado->operation_type == ASSET_DESCRIPTOR_OPERATION_UPDATE) &&
!pado->descriptor.owner_eth_pub_key.has_value())
if ((pado->operation_type == ASSET_DESCRIPTOR_OPERATION_EMIT || pado->operation_type == ASSET_DESCRIPTOR_OPERATION_UPDATE) && (!ftp.ado_sign_thirdparty))
{
asset_operation_ownership_proof aoop{};
r = crypto::generate_schnorr_sig(tx_prefix_hash, sender_account_keys.spend_secret_key, aoop.gss);

View file

@ -29,6 +29,7 @@
#include "currency_format_utils_transactions.h"
#include "core_runtime_config.h"
#include "wallet/wallet_public_structs_defs.h"
#include "wallet/wallet_public_structs_defs.h"
#include "bc_attachments_helpers.h"
#include "bc_payments_id_service.h"
#include "bc_offers_service_basic.h"
@ -164,9 +165,11 @@ namespace currency
uint64_t tx_version;
uint64_t mode_separate_fee = 0;
epee::misc_utils::events_dispatcher* pevents_dispatcher;
epee::misc_utils::events_dispatcher* pevents_dispatcher = nullptr;
tx_generation_context gen_context{}; // solely for consolidated txs
bool ado_sign_thirdparty = false;//@#@ TODO: add to serialization map @zoidberg
BEGIN_SERIALIZE_OBJECT()

View file

@ -5600,6 +5600,7 @@ void wallet2::emit_asset(const crypto::public_key& asset_id, const std::vector<c
send_to_network = false;
ctp.additional_transfer_flags_to_mark = WALLET_TRANSFER_DETAIL_FLAG_ASSET_OP_RESERVATION;
ctp.tx_meaning_for_logs = "asset thirdparty/eth emission";
ctp.ado_sign_thirdparty = true;
}
this->transfer(ctp, ft, send_to_network, nullptr);
@ -7949,6 +7950,7 @@ bool wallet2::prepare_transaction(construct_tx_param& ctp, currency::finalize_tx
ftp.flags = ctp.flags;
ftp.multisig_id = ctp.multisig_id;
ftp.spend_pub_key = m_account.get_public_address().spend_public_key;
ftp.ado_sign_thirdparty = ctp.ado_sign_thirdparty;
/* TODO
WLT_LOG_GREEN("[prepare_transaction]: get_needed_money_time: " << get_needed_money_time << " ms"

View file

@ -229,6 +229,9 @@ namespace tools
// misc
std::string tx_meaning_for_logs; // used to correctly log things, e.g. "escrow" or "asset emission".
uint32_t additional_transfer_flags_to_mark = 0;
//ado
bool ado_sign_thirdparty = false;
};
struct mode_separate_context