1
0
Fork 0
forked from lthn/blockchain

concise mode: last setings for production and tests

This commit is contained in:
cryptozoidberg 2024-09-09 18:26:16 +04:00
parent 1eeb9a4a81
commit 2a2987b17a
No known key found for this signature in database
GPG key ID: 2E10CC61CAC8F36D
5 changed files with 21 additions and 9 deletions

View file

@ -3851,10 +3851,10 @@ namespace tools
}
//delete from recent_history
//if (m_transfer_history.size() > WALLET_CONCISE_MODE_MAX_HISTORY_SIZE)
//{
// m_transfer_history.erase(m_transfer_history.begin(), m_transfer_history.end() - WALLET_CONCISE_MODE_MAX_HISTORY_SIZE);
//}
if (m_truncate_history_max_entries != 0 && m_transfer_history.size() > m_truncate_history_max_entries)
{
m_transfer_history.erase(m_transfer_history.begin(), m_transfer_history.end() - m_truncate_history_max_entries);
}
return true;
}

View file

@ -51,7 +51,7 @@
#define WALLET_DEFAULT_TX_SPENDABLE_AGE CURRENCY_HF4_MANDATORY_MIN_COINAGE
#define WALLET_POS_MINT_CHECK_HEIGHT_INTERVAL 1
#define WALLET_CONCISE_MODE_MAX_REORG_BLOCKS CURRENCY_BLOCKS_PER_DAY * 7 //week
#define WALLET_CONCISE_MODE_MAX_HISTORY_SIZE 500
#define WALLET_CONCISE_MODE_MOBILE_MAX_HISTORY_SIZE 500
const uint64_t WALLET_MINIMUM_HEIGHT_UNSET_CONST = std::numeric_limits<uint64_t>::max();
@ -755,6 +755,7 @@ namespace tools
bool proxy_to_daemon(const std::string& uri, const std::string& body, int& response_code, std::string& response_body);
void set_concise_mode(bool enabled) { m_concise_mode = enabled; }
void set_concise_mode_reorg_max_reorg_blocks(uint64_t max_blocks) { m_wallet_concise_mode_max_reorg_blocks = max_blocks; }
void set_concise_mode_truncate_history(uint64_t max_entries) { m_truncate_history_max_entries = max_entries; }
construct_tx_param get_default_construct_tx_param();
@ -975,9 +976,14 @@ private:
std::atomic<bool> m_concise_mode = true; //in this mode the wallet don't keep spent entries in m_transfers as well as m_recent_transfers longer then 100 entries
uint64_t m_last_known_daemon_height = 0;
uint64_t m_wallet_concise_mode_max_reorg_blocks = 5;//WALLET_CONCISE_MODE_MAX_REORG_BLOCKS;
uint64_t m_wallet_concise_mode_max_reorg_blocks = WALLET_CONCISE_MODE_MAX_REORG_BLOCKS;
uint64_t m_full_resync_requested_at_h = 0;
uint64_t m_truncate_history_max_entries
#ifdef MOBILE_WALLET_BUILD
= WALLET_CONCISE_MODE_MOBILE_MAX_HISTORY_SIZE;
#else
= 0;
#endif
//this needed to access wallets state in coretests, for creating abnormal blocks and tranmsactions
friend class test_generator;
}; // class wallet2

View file

@ -997,6 +997,8 @@ bool test_generator::init_test_wallet(const currency::account_base& account, con
w->set_genesis(genesis_hash);
w->set_core_proxy(m_wallet_test_core_proxy);
w->set_disable_tor_relay(true);
w->set_concise_mode(true);
w->set_concise_mode_reorg_max_reorg_blocks(TESTS_CONCISE_MODE_REORG_MAX_REORG_BLOCK);
result = w;
return true;

View file

@ -19,8 +19,10 @@
#define TESTS_DEFAULT_FEE ((uint64_t)TX_DEFAULT_FEE)
#define MK_TEST_COINS(amount) (static_cast<uint64_t>(amount) * TX_DEFAULT_FEE)
#define TESTS_POS_CONFIG_MIN_COINSTAKE_AGE 4
#define TESTS_POS_CONFIG_POS_MINIMUM_HEIGH 4
#define TESTS_POS_CONFIG_MIN_COINSTAKE_AGE 4
#define TESTS_POS_CONFIG_POS_MINIMUM_HEIGH 4
#define TESTS_CONCISE_MODE_REORG_MAX_REORG_BLOCK 5
namespace concolor
{

View file

@ -57,6 +57,8 @@ struct wallet_test : virtual public test_chain_unit_enchanced
w->set_genesis(genesis_hash);
w->set_core_proxy(m_core_proxy);
w->set_disable_tor_relay(true);
w->set_concise_mode(true);
w->set_concise_mode_reorg_max_reorg_blocks(TESTS_CONCISE_MODE_REORG_MAX_REORG_BLOCK);
return w;
}