mirror of
https://github.com/monero-project/monero.git
synced 2025-08-10 12:40:05 -04:00
Avoid nullptr dereference when constructing Blockchain and tx_memory_pool
This commit is contained in:
parent
0a1eaf26f9
commit
d6f86e58a6
8 changed files with 83 additions and 60 deletions
|
@ -31,6 +31,7 @@
|
|||
#include "common/command_line.h"
|
||||
#include "common/varint.h"
|
||||
#include "cryptonote_basic/cryptonote_boost_serialization.h"
|
||||
#include "blockchain_and_pool.h"
|
||||
#include "cryptonote_core/tx_pool.h"
|
||||
#include "cryptonote_core/cryptonote_core.h"
|
||||
#include "cryptonote_core/blockchain.h"
|
||||
|
@ -203,9 +204,8 @@ int main(int argc, char* argv[])
|
|||
do_diff = command_line::get_arg(vm, arg_diff);
|
||||
|
||||
LOG_PRINT_L0("Initializing source blockchain (BlockchainDB)");
|
||||
std::unique_ptr<Blockchain> core_storage;
|
||||
tx_memory_pool m_mempool(*core_storage);
|
||||
core_storage.reset(new Blockchain(m_mempool));
|
||||
std::unique_ptr<BlockchainAndPool> core_storage = std::make_unique<BlockchainAndPool>();
|
||||
|
||||
BlockchainDB *db = new_db();
|
||||
if (db == NULL)
|
||||
{
|
||||
|
@ -225,7 +225,7 @@ int main(int argc, char* argv[])
|
|||
LOG_PRINT_L0("Error opening database: " << e.what());
|
||||
return 1;
|
||||
}
|
||||
r = core_storage->init(db, net_type);
|
||||
r = core_storage->blockchain.init(db, net_type);
|
||||
|
||||
CHECK_AND_ASSERT_MES(r, 1, "Failed to initialize source blockchain storage");
|
||||
LOG_PRINT_L0("Source blockchain storage initialized OK");
|
||||
|
@ -381,7 +381,7 @@ plot 'stats.csv' index "DATA" using (timecolumn(1,"%Y-%m-%d")):4 with lines, ''
|
|||
if (currblks)
|
||||
doprint();
|
||||
|
||||
core_storage->deinit();
|
||||
core_storage->blockchain.deinit();
|
||||
return 0;
|
||||
|
||||
CATCH_ENTRY("Stats reporting error", 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue