aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-30 12:58:15 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-30 15:06:03 +0000
commitbc8a52efd8dcda4544856e724a17c9cba161d4a2 (patch)
tree579f443671f7922979940a14f90ddd5f4e38273b /src/wallet/wallet2.cpp
parentwallet: protect against exceptions in the block pull thread (diff)
downloadmonero-bc8a52efd8dcda4544856e724a17c9cba161d4a2.tar.xz
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.
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 19b598af8..e58629dac 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -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))