Merge pull request #3002

9996d5e9 wallet2: guard against the dameon sending blocks before last checkpoint (moneromooo-monero)
eadaa6aa wallet_rpc_server: fix wallet leak on error exit (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-01-10 11:54:11 +01:00
commit 990389f09d
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
2 changed files with 7 additions and 0 deletions

View File

@ -2036,6 +2036,11 @@ void wallet2::fast_refresh(uint64_t stop_height, uint64_t &blocks_start_height,
pull_hashes(0, blocks_start_height, short_chain_history, hashes);
if (hashes.size() <= 3)
return;
if (blocks_start_height < m_blockchain.offset())
{
MERROR("Blocks start before blockchain offset: " << blocks_start_height << " " << m_blockchain.offset());
return;
}
if (hashes.size() + current_index < stop_height) {
drop_from_short_history(short_chain_history, 3);
std::list<crypto::hash>::iterator right = hashes.end();

View File

@ -89,6 +89,8 @@ namespace tools
//------------------------------------------------------------------------------------------------------------------------------
wallet_rpc_server::~wallet_rpc_server()
{
if (m_wallet)
delete m_wallet;
}
//------------------------------------------------------------------------------------------------------------------------------
void wallet_rpc_server::set_wallet(wallet2 *cr)