1
0
Fork 0
forked from lthn/blockchain

tweak for decoy selection algo: first 20k of Zarcanum blocks decoy selection algo will be working flat

This commit is contained in:
cryptozoidberg 2024-01-17 22:02:06 +01:00
parent 6365b55343
commit 36ce7bd00d
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
2 changed files with 8 additions and 2 deletions

View file

@ -2832,7 +2832,11 @@ bool blockchain_storage::get_random_outs_for_amounts2(const COMMAND_RPC_GET_RAND
{
CRITICAL_REGION_LOCAL(m_read_lock);
LOG_PRINT_L3("[get_random_outs_for_amounts] amounts: " << req.amounts.size());
std::map<uint64_t, uint64_t> amounts_to_up_index_limit_cache;
std::map<uint64_t, uint64_t> amounts_to_up_index_limit_cache;
uint64_t count_zarcanum_blocks = 0;
if(is_hardfork_active(ZANO_HARDFORK_04_ZARCANUM))
count_zarcanum_blocks = this->get_current_blockchain_size() - m_core_runtime_config.hard_forks.m_height_the_hardfork_n_active_after[ZANO_HARDFORK_04_ZARCANUM];
for (size_t i = 0; i != req.amounts.size(); i++)
{
@ -2842,7 +2846,7 @@ bool blockchain_storage::get_random_outs_for_amounts2(const COMMAND_RPC_GET_RAND
result_outs.amount = amount;
bool r = false;
if (amount == 0)
if (amount == 0 && count_zarcanum_blocks > 20000)
{
//zarcanum era inputs
r = get_target_outs_for_postzarcanum(req, req.amounts[i], result_outs, amounts_to_up_index_limit_cache);

View file

@ -5925,6 +5925,7 @@ bool wallet2::prepare_tx_sources(size_t fake_outputs_count, std::vector<currency
size_t attempt_count = 0;
while (true)
{
daemon_resp = COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::response();
bool r = m_core_proxy->call_COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS2(req, daemon_resp);
THROW_IF_FALSE_WALLET_EX(r, error::no_connection_to_daemon, "getrandom_outs2.bin");
if(daemon_resp.status == API_RETURN_CODE_FAIL)
@ -5944,6 +5945,7 @@ bool wallet2::prepare_tx_sources(size_t fake_outputs_count, std::vector<currency
THROW_IF_FALSE_WALLET_EX(daemon_resp.status == API_RETURN_CODE_OK, error::get_random_outs_error, daemon_resp.status);
WLT_THROW_IF_FALSE_WALLET_INT_ERR_EX(daemon_resp.outs.size() == selected_indicies.size(),
"daemon returned wrong response for getrandom_outs.bin, wrong amounts count = " << daemon_resp.outs.size() << ", expected: " << selected_indicies.size());
break;
}
std::vector<COMMAND_RPC_GET_RANDOM_OUTPUTS_FOR_AMOUNTS::outs_for_amount> scanty_outs;