message(STATUS"Found BerkeleyDB includes, but could not find BerkeleyDB library. Please make sure you have installed libdb and libdb-dev or the equivalent")
endif()
endif()
find_package(BerkeleyDB)
if(NOTBERKELEY_DB_LIBRARIES)
message(STATUS"BerkeleyDB not found and has been disabled.")
else()
message(STATUS"Found BerkeleyDB include (db.h) in ${BERKELEY_DB_INCLUDE_DIR}")
if(BERKELEY_DB_LIBRARIES)
message(STATUS"Found BerkeleyDB shared library")
set(BDB_STATICfalseCACHEBOOL"BDB Static flag")
set(BDB_INCLUDE${BERKELEY_DB_INCLUDE_DIR}CACHESTRING"BDB include path")
message(STATUS"Found BerkeleyDB includes, but could not find BerkeleyDB library. Please make sure you have installed libdb and libdb-dev or the equivalent")
lmdb_db_open(txn,LMDB_OUTPUT_TXS,MDB_INTEGERKEY|MDB_CREATE,m_output_txs,"Failed to open db handle for m_output_txs");
lmdb_db_open(txn,LMDB_OUTPUT_INDICES,MDB_INTEGERKEY|MDB_CREATE,m_output_indices,"Failed to open db handle for m_output_indices");
lmdb_db_open(txn,LMDB_OUTPUT_AMOUNTS,MDB_INTEGERKEY|MDB_DUPSORT|MDB_DUPFIXED|MDB_CREATE,m_output_amounts,"Failed to open db handle for m_output_amounts");
lmdb_db_open(txn,LMDB_OUTPUT_AMOUNTS,MDB_INTEGERKEY|MDB_DUPSORT|MDB_DUPFIXED|MDB_CREATE,m_output_amounts,"Failed to open db handle for m_output_amounts");
lmdb_db_open(txn,LMDB_OUTPUT_KEYS,MDB_INTEGERKEY|MDB_CREATE,m_output_keys,"Failed to open db handle for m_output_keys");
lmdb_db_open(txn,LMDB_SPENT_KEYS,MDB_CREATE,m_spent_keys,"Failed to open db handle for m_spent_keys");
LOG_PRINT_L1("Failed to check ring signature for tx "<<get_transaction_hash(tx)<<" vin key with k_image: "<<in_to_key.k_image<<" sig_index: "<<sig_index);
if(pmax_used_block_height)// a default value of NULL is used when called from Blockchain::handle_block_to_main_chain()
LOG_PRINT_L1("Failed to check ring signature for tx "<<get_transaction_hash(tx)<<" vin key with k_image: "<<in_to_key.k_image<<" sig_index: "<<sig_index);
if(pmax_used_block_height)// a default value of NULL is used when called from Blockchain::handle_block_to_main_chain()
LOG_PRINT_L1("Failed to check ring signature for tx "<<get_transaction_hash(tx)<<" vin key with k_image: "<<in_to_key.k_image<<" sig_index: "<<sig_index);
if(pmax_used_block_height)// a default value of NULL is used when called from Blockchain::handle_block_to_main_chain()
LOG_PRINT_L1("Failed to check ring signature for tx "<<get_transaction_hash(tx)<<" vin key with k_image: "<<in_to_key.k_image<<" sig_index: "<<sig_index);
KILL_IOSERVICE();
returnfalse;
if(pmax_used_block_height)// a default value of NULL is used when called from Blockchain::handle_block_to_main_chain()
CHECK_AND_ASSERT_MES(m_checkpoints.is_alternative_block_allowed(m_blocks.size()-1,alt_block.second.height),false,"stored alternative block not allowed, blockchain.bin invalid");
CHECK_AND_ASSERT_MES(m_checkpoints.is_alternative_block_allowed(m_blocks.size()-1,alt_block.second.height),false,"stored alternative block not allowed, blockchain.bin invalid");
@ -1837,13 +1837,13 @@ void blockchain_storage::check_against_checkpoints(const checkpoints& points, bo
// if asked to enforce checkpoints, roll back to a couple of blocks before the checkpoint
if(enforce)
{
LOG_ERROR("Local blockchain failed to pass a checkpoint, rolling back!");
std::list<block>empty;
rollback_blockchain_switching(empty,pt.first-2);
LOG_ERROR("Local blockchain failed to pass a checkpoint, rolling back!");
std::list<block>empty;
rollback_blockchain_switching(empty,pt.first-2);
}
else
{
LOG_ERROR("WARNING: local blockchain failed to pass a MoneroPulse checkpoint, and you could be on a fork. You should either sync up from scratch, OR download a fresh blockchain bootstrap, OR enable checkpoint enforcing with the --enforce-dns-checkpointing command-line option");
LOG_ERROR("WARNING: local blockchain failed to pass a MoneroPulse checkpoint, and you could be on a fork. You should either sync up from scratch, OR download a fresh blockchain bootstrap, OR enable checkpoint enforcing with the --enforce-dns-checkpointing command-line option");
// return m_core.get_blockchain_storage().get_avg_block_size(count); // this does not count too well the actuall network-size of data we need to download
CRITICAL_REGION_LOCAL(m_buffer_mutex);
double avg = 0;
if (m_avg_buffer.size() == 0) {
_warn("m_avg_buffer.size() == 0");
return 500;
}
const bool dbg_poke_lock = 0; // debug: try to trigger an error by poking around with locks. TODO: configure option
long int dbg_repeat=0;
do {
for (auto element : m_avg_buffer) avg += element;
} while(dbg_poke_lock && (dbg_repeat++)<100000); // in debug/poke mode, repeat this calculation to trigger hidden locking error if there is one
return avg / m_avg_buffer.size();
// return m_core.get_blockchain_storage().get_avg_block_size(count); // this does not count too well the actuall network-size of data we need to download
CRITICAL_REGION_LOCAL(m_buffer_mutex);
double avg = 0;
if (m_avg_buffer.size() == 0) {
_warn("m_avg_buffer.size() == 0");
return 500;
}
const bool dbg_poke_lock = 0; // debug: try to trigger an error by poking around with locks. TODO: configure option
long int dbg_repeat=0;
do {
for (auto element : m_avg_buffer) avg += element;
} while(dbg_poke_lock && (dbg_repeat++)<100000); // in debug/poke mode, repeat this calculation to trigger hidden locking error if there is one
return avg / m_avg_buffer.size();
}
@ -440,33 +440,33 @@ namespace cryptonote
size_t size = 0;
for (auto element : arg.txs) size += element.size();
for (auto element : arg.blocks) {
size += element.block.size();
for (auto tx : element.txs)
size += tx.size();
}
for (auto element : arg.missed_ids)
size += sizeof(element.data);
size += sizeof(arg.current_blockchain_height);
{
CRITICAL_REGION_LOCAL(m_buffer_mutex);
m_avg_buffer.push_back(size);
const bool dbg_poke_lock = 0; // debug: try to trigger an error by poking around with locks. TODO: configure option
long int dbg_repeat=0;
do {
m_avg_buffer.push_back(666); // a test value
m_avg_buffer.erase_end(1);
} while(dbg_poke_lock && (dbg_repeat++)<100000); // in debug/poke mode, repeat this calculation to trigger hidden locking error if there is one
}
/*using namespace boost::chrono;
auto point = steady_clock::now();
auto time_from_epoh = point.time_since_epoch();
auto sec = duration_cast< seconds >( time_from_epoh ).count();*/
const command_line::arg_descriptor<std::vector<std::string> > arg_p2p_seed_node = {"seed-node", "Connect to a node to retrieve peer addresses, and disconnect"};
const command_line::arg_descriptor<bool> arg_p2p_hide_my_port = {"hide-my-port", "Do not announce yourself as peerlist candidate", false, true};
const command_line::arg_descriptor<bool> arg_no_igd= {"no-igd", "Disable UPnP port mapping"};
const command_line::arg_descriptor<bool> arg_offline= {"offline", "Do not listen for peers, nor connect to any"};
const command_line::arg_descriptor<int64_t> arg_out_peers = {"out-peers", "set max limit of out peers", -1};
const command_line::arg_descriptor<int> arg_tos_flag = {"tos-flag", "set TOS flag", -1};
const command_line::arg_descriptor<bool> arg_no_igd= {"no-igd", "Disable UPnP port mapping"};
const command_line::arg_descriptor<bool> arg_offline= {"offline", "Do not listen for peers, nor connect to any"};
const command_line::arg_descriptor<int64_t> arg_out_peers = {"out-peers", "set max limit of out peers", -1};
const command_line::arg_descriptor<int> arg_tos_flag = {"tos-flag", "set TOS flag", -1};