mirror of
https://github.com/monero-project/monero.git
synced 2025-05-28 16:42:15 -04:00
wallet: add a rescan_bc command and rescan_blockchain RPC
Blockchain hashes and key images are flushed, and blocks are pulled anew from the daemon. The console command is shortened to match bc_height. This should make it a lot easier on users who are currently told to remove this particular cache file but keep the keys one, etc, etc.
This commit is contained in:
parent
92ef6b54fe
commit
bc8a52efd8
7 changed files with 84 additions and 13 deletions
|
@ -801,6 +801,7 @@ bool wallet2::clear()
|
|||
{
|
||||
m_blockchain.clear();
|
||||
m_transfers.clear();
|
||||
m_key_images.clear();
|
||||
m_local_bc_height = 1;
|
||||
return true;
|
||||
}
|
||||
|
@ -1431,6 +1432,20 @@ void wallet2::rescan_spent()
|
|||
}
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
void wallet2::rescan_blockchain(bool refresh)
|
||||
{
|
||||
clear();
|
||||
|
||||
cryptonote::block genesis;
|
||||
generate_genesis(genesis);
|
||||
crypto::hash genesis_hash = get_block_hash(genesis);
|
||||
m_blockchain.push_back(genesis_hash);
|
||||
m_local_bc_height = 1;
|
||||
|
||||
if (refresh)
|
||||
this->refresh();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
bool wallet2::is_transfer_unlocked(const transfer_details& td) const
|
||||
{
|
||||
if(!is_tx_spendtime_unlocked(td.m_tx.unlock_time))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue