forked from lthn/blockchain
more logs on chainshortener
This commit is contained in:
parent
c8c2414fd3
commit
a3dcb32834
3 changed files with 25 additions and 1 deletions
|
|
@ -2667,6 +2667,7 @@ void wallet2::load(const std::wstring& wallet_, const std::string& password)
|
|||
if (wbh.m_ver == WALLET_FILE_BINARY_HEADER_VERSION_INITAL)
|
||||
{
|
||||
need_to_resync = !tools::portable_unserialize_obj_from_stream(*this, data_file);
|
||||
WLT_LOG_L0("Detected format: WALLET_FILE_BINARY_HEADER_VERSION_INITAL(need_to_resync=" << need_to_resync << ")");
|
||||
}
|
||||
else if (wbh.m_ver == WALLET_FILE_BINARY_HEADER_VERSION_2)
|
||||
{
|
||||
|
|
@ -2675,6 +2676,7 @@ void wallet2::load(const std::wstring& wallet_, const std::string& password)
|
|||
in.push(decrypt_filter);
|
||||
in.push(data_file);
|
||||
need_to_resync = !tools::portable_unserialize_obj_from_stream(*this, in);
|
||||
WLT_LOG_L0("Detected format: WALLET_FILE_BINARY_HEADER_VERSION_2(need_to_resync=" << need_to_resync << ")");
|
||||
}
|
||||
else if(wbh.m_ver == WALLET_FILE_BINARY_HEADER_VERSION_3)
|
||||
{
|
||||
|
|
@ -2683,6 +2685,7 @@ void wallet2::load(const std::wstring& wallet_, const std::string& password)
|
|||
in.push(decrypt_filter);
|
||||
in.push(data_file);
|
||||
need_to_resync = !tools::portable_unserialize_obj_from_stream2(*this, in);
|
||||
WLT_LOG_L0("Detected format: WALLET_FILE_BINARY_HEADER_VERSION_3(need_to_resync="<< need_to_resync <<")");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2703,6 +2706,8 @@ void wallet2::load(const std::wstring& wallet_, const std::string& password)
|
|||
<< ", file_size=" << m_current_wallet_file_size
|
||||
<< ", blockchain_size: " << m_chain.get_blockchain_current_size()
|
||||
);
|
||||
WLT_LOG_L0("[LOADING]Blockchain shortener state: " << ENDL << m_chain.get_internal_state_text());
|
||||
|
||||
|
||||
WLT_LOG_L0("(after loading: pending_key_images: " << m_pending_key_images.size() << ", pki file elements: " << m_pending_key_images_file_container.size() << ", tx_keys: " << m_tx_keys.size() << ")");
|
||||
|
||||
|
|
@ -2776,6 +2781,8 @@ void wallet2::store(const std::wstring& path_to_save, const std::string& passwor
|
|||
boost::uintmax_t tmp_file_size = boost::filesystem::file_size(tmp_file_path);
|
||||
WLT_LOG_L0("Stored successfully to temporary file " << tmp_file_path.string() << ", file size=" << tmp_file_size);
|
||||
|
||||
WLT_LOG_L0("[LOADING]Blockchain shortener state: " << ENDL << m_chain.get_internal_state_text());
|
||||
|
||||
// for the sake of safety perform a double-renaming: wallet file -> old tmp, new tmp -> wallet file, remove old tmp
|
||||
|
||||
boost::filesystem::path tmp_old_file_path = boost::filesystem::path(path_to_save);
|
||||
|
|
|
|||
|
|
@ -274,6 +274,23 @@ void wallet_chain_shortener::check_if_block_matched(uint64_t i, const crypto::ha
|
|||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
std::string wallet_chain_shortener::get_internal_state_text() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
#define PRINT_CHAIN_SHORTENER_STATE_INFO(cont_name) \
|
||||
if (cont_name.size()) \
|
||||
{ \
|
||||
ss << #cont_name << ".size(): [" << cont_name.begin().first << ": " << cont_name.begin().second << "]" << ENDL; \
|
||||
}
|
||||
|
||||
PRINT_CHAIN_SHORTENER_STATE_INFO(m_last_20_blocks);
|
||||
PRINT_CHAIN_SHORTENER_STATE_INFO(m_last_144_blocks_every_10);
|
||||
PRINT_CHAIN_SHORTENER_STATE_INFO(m_last_144_blocks_every_100);
|
||||
PRINT_CHAIN_SHORTENER_STATE_INFO(m_last_144_blocks_every_1000);
|
||||
ss << "m_local_bc_size = " << m_local_bc_size << ENDL;
|
||||
return ss.str();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void clean_map_from_items_above(std::map<uint64_t, crypto::hash>& container, uint64_t height)
|
||||
{
|
||||
while (container.size() && (--container.end())->first >= height)
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public:
|
|||
}
|
||||
|
||||
//debug functions
|
||||
|
||||
std::string get_internal_state_text() const;
|
||||
private:
|
||||
std::atomic<uint64_t> m_local_bc_size; //temporary workaround
|
||||
crypto::hash m_genesis;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue