mirror of
https://git.wownero.com/wownero/onion-wownero-blockchain-explorer.git
synced 2024-08-15 00:33:12 +00:00
fix popping blocks
https://github.com/moneroexamples/onion-monero-blockchain-explorer/issues/119
This commit is contained in:
parent
35db6a00ca
commit
bf39420c8a
4 changed files with 15 additions and 24 deletions
|
@ -55,6 +55,7 @@ Alternative block explorers:
|
|||
|
||||
- [http://moneroblocks.info](http://moneroblocks.info/)
|
||||
- [https://monerobase.com](https://monerobase.com/)
|
||||
- [https://monerovision.com](https://monerovision.com)
|
||||
- [http://chainradar.com](http://chainradar.com/xmr/blocks)
|
||||
|
||||
|
||||
|
|
2
main.cpp
2
main.cpp
|
@ -158,7 +158,7 @@ main(int ac, const char* av[])
|
|||
|
||||
// initialize mcore and core_storage
|
||||
if (!xmreg::init_blockchain(blockchain_path.string(),
|
||||
mcore, core_storage))
|
||||
mcore, core_storage, nettype))
|
||||
{
|
||||
cerr << "Error accessing blockchain." << endl;
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -45,31 +45,20 @@ MicroCore::MicroCore():
|
|||
* Initialize m_blockchain_storage with the BlockchainLMDB object.
|
||||
*/
|
||||
bool
|
||||
MicroCore::init(const string& _blockchain_path)
|
||||
MicroCore::init(const string& _blockchain_path, network_type nt)
|
||||
{
|
||||
int db_flags = 0;
|
||||
|
||||
blockchain_path = _blockchain_path;
|
||||
|
||||
//db_flags |= MDB_RDONLY;
|
||||
nettype = nt;
|
||||
|
||||
db_flags |= MDB_RDONLY;
|
||||
db_flags |= MDB_NOLOCK;
|
||||
//db_flags |= MDB_SYNC;
|
||||
|
||||
// uint64_t DEFAULT_FLAGS = MDB_NOMETASYNC | MDB_NORDAHEAD;
|
||||
|
||||
//db_flags = DEFAULT_FLAGS;
|
||||
|
||||
HardFork* m_hardfork = nullptr;
|
||||
|
||||
BlockchainDB* db = nullptr;
|
||||
db = new BlockchainLMDB();
|
||||
|
||||
bool use_testnet {false};
|
||||
|
||||
uint64_t hard_fork_version_1_till = use_testnet ? testnet_hard_fork_version_1_till : mainnet_hard_fork_version_1_till;
|
||||
|
||||
m_hardfork = new HardFork(*db, 1, hard_fork_version_1_till);
|
||||
|
||||
try
|
||||
{
|
||||
// try opening lmdb database files
|
||||
|
@ -84,13 +73,11 @@ MicroCore::init(const string& _blockchain_path)
|
|||
// check if the blockchain database
|
||||
// is successful opened
|
||||
if(!db->is_open())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// initialize Blockchain object to manage
|
||||
// the database.
|
||||
return m_blockchain_storage.init(db, m_hardfork, network_type::MAINNET);
|
||||
return m_blockchain_storage.init(db, nettype);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -337,11 +324,12 @@ MicroCore::~MicroCore()
|
|||
bool
|
||||
init_blockchain(const string& path,
|
||||
MicroCore& mcore,
|
||||
Blockchain*& core_storage)
|
||||
Blockchain*& core_storage,
|
||||
network_type nt)
|
||||
{
|
||||
|
||||
// initialize the core using the blockchain path
|
||||
if (!mcore.init(path))
|
||||
if (!mcore.init(path, nt))
|
||||
{
|
||||
cerr << "Error accessing blockchain." << endl;
|
||||
return false;
|
||||
|
|
|
@ -33,11 +33,13 @@ namespace xmreg
|
|||
|
||||
hw::device* m_device;
|
||||
|
||||
network_type nettype;
|
||||
|
||||
public:
|
||||
MicroCore();
|
||||
|
||||
bool
|
||||
init(const string& _blockchain_path);
|
||||
init(const string& _blockchain_path, network_type nt);
|
||||
|
||||
Blockchain&
|
||||
get_core();
|
||||
|
@ -77,11 +79,11 @@ namespace xmreg
|
|||
|
||||
|
||||
|
||||
|
||||
bool
|
||||
init_blockchain(const string& path,
|
||||
MicroCore& mcore,
|
||||
Blockchain*& core_storage);
|
||||
Blockchain*& core_storage,
|
||||
network_type nt);
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue