diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-11-06 21:30:12 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-11-06 21:30:12 +0200 |
commit | 164ba3ef1cefbcd4a45fbe5b821b5ba495f446a2 (patch) | |
tree | 9cf1a0c576de70a293c870aea9b465aff3b75b96 /src/wallet/wallet2.cpp | |
parent | Merge pull request #4730 (diff) | |
parent | wallet: add a non destructive blockchain rescan (diff) | |
download | monero-164ba3ef1cefbcd4a45fbe5b821b5ba495f446a2.tar.xz |
Merge pull request #4731
f26ce08c wallet: add a non destructive blockchain rescan (moneromooo-monero)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r-- | src/wallet/wallet2.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index a5faee71b..9f2a9f426 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -5105,11 +5105,27 @@ void wallet2::rescan_spent() } } //---------------------------------------------------------------------------------------------------- -void wallet2::rescan_blockchain(bool refresh) +void wallet2::rescan_blockchain(bool hard, bool refresh) { - clear(); + if(hard) + { + clear(); + setup_new_blockchain(); + } + else + { + m_blockchain.clear(); + m_transfers.clear(); + m_key_images.clear(); + m_pub_keys.clear(); + m_scanned_pool_txs[0].clear(); + m_scanned_pool_txs[1].clear(); - setup_new_blockchain(); + cryptonote::block b; + generate_genesis(b); + m_blockchain.push_back(get_block_hash(b)); + m_last_block_reward = cryptonote::get_outs_money_amount(b.miner_tx); + } if (refresh) this->refresh(false); |