mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +00:00
wallet2: remove old blockchain size cache hack
This commit is contained in:
parent
dcfd299239
commit
5d3e70229e
2 changed files with 3 additions and 16 deletions
|
@ -769,8 +769,6 @@ bool wallet2::init(std::string daemon_address, boost::optional<epee::net_utils::
|
|||
m_daemon_address = std::move(daemon_address);
|
||||
m_daemon_login = std::move(daemon_login);
|
||||
// When switching from light wallet to full wallet, we need to reset the height we got from lw node.
|
||||
if(m_light_wallet)
|
||||
m_local_bc_height = m_blockchain.size();
|
||||
return m_http_client.set_server(get_daemon_address(), get_daemon_login(), ssl);
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
@ -1680,7 +1678,6 @@ void wallet2::process_new_blockchain_entry(const cryptonote::block& b, const cry
|
|||
LOG_PRINT_L2( "Skipped block by timestamp, height: " << height << ", block time " << b.timestamp << ", account time " << m_account.get_createtime());
|
||||
}
|
||||
m_blockchain.push_back(bl_id);
|
||||
++m_local_bc_height;
|
||||
|
||||
if (0 != m_callback)
|
||||
m_callback->on_new_block(height, b);
|
||||
|
@ -2258,7 +2255,6 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height,
|
|||
while (missing_blocks-- > 0)
|
||||
m_blockchain.push_back(crypto::null_hash); // maybe a bit suboptimal, but deque won't do huge reallocs like vector
|
||||
m_blockchain.push_back(m_checkpoints.get_points().at(checkpoint_height));
|
||||
m_local_bc_height = m_blockchain.size();
|
||||
short_chain_history.clear();
|
||||
get_short_chain_history(short_chain_history);
|
||||
}
|
||||
|
@ -2291,7 +2287,6 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height,
|
|||
if (!(current_index % 1000))
|
||||
LOG_PRINT_L2( "Skipped block by height: " << current_index);
|
||||
m_blockchain.push_back(bl_id);
|
||||
++m_local_bc_height;
|
||||
|
||||
if (0 != m_callback)
|
||||
{ // FIXME: this isn't right, but simplewallet just logs that we got a block.
|
||||
|
@ -2352,7 +2347,6 @@ void wallet2::refresh(uint64_t start_height, uint64_t & blocks_fetched, bool& re
|
|||
// Update lw heights
|
||||
m_light_wallet_scanned_block_height = res.scanned_block_height;
|
||||
m_light_wallet_blockchain_height = res.blockchain_height;
|
||||
m_local_bc_height = res.blockchain_height;
|
||||
// If new height - call new_block callback
|
||||
if(m_light_wallet_blockchain_height != prev_height)
|
||||
{
|
||||
|
@ -2607,7 +2601,6 @@ void wallet2::detach_blockchain(uint64_t height)
|
|||
|
||||
size_t blocks_detached = m_blockchain.size() - height;
|
||||
m_blockchain.crop(height);
|
||||
m_local_bc_height -= blocks_detached;
|
||||
|
||||
for (auto it = m_payments.begin(); it != m_payments.end(); )
|
||||
{
|
||||
|
@ -2649,7 +2642,6 @@ bool wallet2::clear()
|
|||
m_scanned_pool_txs[0].clear();
|
||||
m_scanned_pool_txs[1].clear();
|
||||
m_address_book.clear();
|
||||
m_local_bc_height = 1;
|
||||
m_subaddresses.clear();
|
||||
m_subaddress_labels.clear();
|
||||
return true;
|
||||
|
@ -4025,8 +4017,6 @@ void wallet2::load(const std::string& wallet_, const epee::wipeable_string& pass
|
|||
if (get_num_subaddress_accounts() == 0)
|
||||
add_subaddress_account(tr("Primary account"));
|
||||
|
||||
m_local_bc_height = m_blockchain.size();
|
||||
|
||||
try
|
||||
{
|
||||
find_and_save_rings(false);
|
||||
|
@ -4406,7 +4396,6 @@ void wallet2::rescan_blockchain(bool refresh)
|
|||
crypto::hash genesis_hash = get_block_hash(genesis);
|
||||
m_blockchain.push_back(genesis_hash);
|
||||
add_subaddress_account(tr("Primary account"));
|
||||
m_local_bc_height = 1;
|
||||
|
||||
if (refresh)
|
||||
this->refresh();
|
||||
|
@ -4422,7 +4411,7 @@ bool wallet2::is_transfer_unlocked(uint64_t unlock_time, uint64_t block_height)
|
|||
if(!is_tx_spendtime_unlocked(unlock_time, block_height))
|
||||
return false;
|
||||
|
||||
if(block_height + CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE > m_local_bc_height)
|
||||
if(block_height + CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE > get_blockchain_current_height())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -4433,7 +4422,7 @@ bool wallet2::is_tx_spendtime_unlocked(uint64_t unlock_time, uint64_t block_heig
|
|||
if(unlock_time < CRYPTONOTE_MAX_BLOCK_NUMBER)
|
||||
{
|
||||
//interpret as block index
|
||||
if(m_local_bc_height-1 + CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS >= unlock_time)
|
||||
if(get_blockchain_current_height()-1 + CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS >= unlock_time)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
@ -10001,7 +9990,6 @@ void wallet2::import_blockchain(const std::tuple<size_t, crypto::hash, std::vect
|
|||
generate_genesis(genesis);
|
||||
crypto::hash genesis_hash = get_block_hash(genesis);
|
||||
check_genesis(genesis_hash);
|
||||
m_local_bc_height = m_blockchain.size();
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
std::vector<tools::wallet2::transfer_details> wallet2::export_outputs() const
|
||||
|
|
|
@ -745,7 +745,7 @@ namespace tools
|
|||
void get_unconfirmed_payments_out(std::list<std::pair<crypto::hash,wallet2::unconfirmed_transfer_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
|
||||
void get_unconfirmed_payments(std::list<std::pair<crypto::hash,wallet2::pool_payment_details>>& unconfirmed_payments, const boost::optional<uint32_t>& subaddr_account = boost::none, const std::set<uint32_t>& subaddr_indices = {}) const;
|
||||
|
||||
uint64_t get_blockchain_current_height() const { return m_local_bc_height; }
|
||||
uint64_t get_blockchain_current_height() const { return m_light_wallet_blockchain_height ? m_light_wallet_blockchain_height : m_blockchain.size(); }
|
||||
void rescan_spent();
|
||||
void rescan_blockchain(bool refresh = true);
|
||||
bool is_transfer_unlocked(const transfer_details& td) const;
|
||||
|
@ -1200,7 +1200,6 @@ namespace tools
|
|||
std::string m_keys_file;
|
||||
epee::net_utils::http::http_simple_client m_http_client;
|
||||
hashchain m_blockchain;
|
||||
std::atomic<uint64_t> m_local_bc_height; //temporary workaround
|
||||
std::unordered_map<crypto::hash, unconfirmed_transfer_details> m_unconfirmed_txs;
|
||||
std::unordered_map<crypto::hash, confirmed_transfer_details> m_confirmed_txs;
|
||||
std::unordered_multimap<crypto::hash, pool_payment_details> m_unconfirmed_payments;
|
||||
|
|
Loading…
Reference in a new issue