Mac ARM64 builds working with depends

This commit is contained in:
Some Random Crypto Guy
2024-06-17 11:52:11 +01:00
parent 7f64a43de9
commit 6d695e0005
97 changed files with 3450 additions and 3743 deletions
+9
View File
@@ -141,6 +141,7 @@ target_link_libraries(blockchain_import
PRIVATE
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
@@ -168,6 +169,7 @@ target_link_libraries(blockchain_export
PRIVATE
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
@@ -190,6 +192,7 @@ target_link_libraries(blockchain_blackball
wallet
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
@@ -212,6 +215,7 @@ target_link_libraries(blockchain_usage
PRIVATE
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
@@ -233,6 +237,7 @@ target_link_libraries(blockchain_ancestry
PRIVATE
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
@@ -254,6 +259,7 @@ target_link_libraries(blockchain_depth
PRIVATE
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
@@ -275,6 +281,7 @@ target_link_libraries(blockchain_stats
PRIVATE
cryptonote_core
blockchain_db
oracle
version
epee
${Boost_FILESYSTEM_LIBRARY}
@@ -296,6 +303,7 @@ target_link_libraries(blockchain_prune_known_spent_data
PRIVATE
cryptonote_core
blockchain_db
oracle
p2p
version
epee
@@ -323,6 +331,7 @@ target_link_libraries(blockchain_prune
PRIVATE
cryptonote_core
blockchain_db
oracle
p2p
version
epee
@@ -449,9 +449,7 @@ int main(int argc, char* argv[])
// because unlike blockchain_storage constructor, which takes a pointer to
// tx_memory_pool, Blockchain's constructor takes tx_memory_pool object.
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)
{
@@ -472,7 +470,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");
@@ -716,7 +714,7 @@ int main(int argc, char* argv[])
}
done:
core_storage->deinit();
core_storage->blockchain.deinit();
if (opt_show_cache_stats)
MINFO("cache: txes " << std::to_string(cached_txes*100./total_txes)
@@ -136,9 +136,7 @@ int main(int argc, char* argv[])
// because unlike blockchain_storage constructor, which takes a pointer to
// tx_memory_pool, Blockchain's constructor takes tx_memory_pool object.
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)
{
@@ -159,7 +157,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");
@@ -327,7 +325,7 @@ done:
LOG_PRINT_L0("Average min depth for " << start_txids.size() << " transaction(s): " << cumulative_depth/(float)depths.size());
LOG_PRINT_L0("Median min depth for " << start_txids.size() << " transaction(s): " << epee::misc_utils::median(depths));
core_storage->deinit();
core_storage->blockchain.deinit();
return 0;
CATCH_ENTRY("Depth query error", 1);
@@ -136,9 +136,7 @@ int main(int argc, char* argv[])
// because unlike blockchain_storage constructor, which takes a pointer to
// tx_memory_pool, Blockchain's constructor takes tx_memory_pool object.
LOG_PRINT_L0("Initializing source blockchain (BlockchainDB)");
Blockchain* core_storage = NULL;
tx_memory_pool m_mempool(*core_storage);
core_storage = new Blockchain(m_mempool);
std::unique_ptr<BlockchainAndPool> core_storage = std::make_unique<BlockchainAndPool>();
BlockchainDB* db = new_db();
if (db == NULL)
@@ -162,9 +160,9 @@ int main(int argc, char* argv[])
LOG_PRINT_L0("Error opening database: " << e.what());
return 1;
}
r = core_storage->init(db, opt_testnet ? cryptonote::TESTNET : opt_stagenet ? cryptonote::STAGENET : cryptonote::MAINNET);
r = core_storage->blockchain.init(db, opt_testnet ? cryptonote::TESTNET : opt_stagenet ? cryptonote::STAGENET : cryptonote::MAINNET);
if (core_storage->get_blockchain_pruning_seed() && !opt_blocks_dat)
if (core_storage->blockchain.get_blockchain_pruning_seed() && !opt_blocks_dat)
{
LOG_PRINT_L0("Blockchain is pruned, cannot export");
return 1;
@@ -177,12 +175,12 @@ int main(int argc, char* argv[])
if (opt_blocks_dat)
{
BlocksdatFile blocksdat;
r = blocksdat.store_blockchain_raw(core_storage, NULL, output_file_path, block_stop);
r = blocksdat.store_blockchain_raw(&core_storage->blockchain, NULL, output_file_path, block_stop);
}
else
{
BootstrapFile bootstrap;
r = bootstrap.store_blockchain_raw(core_storage, NULL, output_file_path, block_start, block_stop);
r = bootstrap.store_blockchain_raw(&core_storage->blockchain, NULL, output_file_path, block_start, block_stop);
}
CHECK_AND_ASSERT_MES(r, 1, "Failed to export blockchain raw data");
LOG_PRINT_L0("Blockchain raw data exported OK");
@@ -524,15 +524,14 @@ int main(int argc, char* argv[])
// because unlike blockchain_storage constructor, which takes a pointer to
// tx_memory_pool, Blockchain's constructor takes tx_memory_pool object.
MINFO("Initializing source blockchain (BlockchainDB)");
std::array<std::unique_ptr<Blockchain>, 2> core_storage;
Blockchain *blockchain = NULL;
tx_memory_pool m_mempool(*blockchain);
std::array<std::unique_ptr<BlockchainAndPool>, 2> core_storage{
std::make_unique<BlockchainAndPool>(),
std::make_unique<BlockchainAndPool>()};
boost::filesystem::path paths[2];
bool already_pruned = false;
for (size_t n = 0; n < core_storage.size(); ++n)
{
core_storage[n].reset(new Blockchain(m_mempool));
BlockchainDB* db = new_db();
if (db == NULL)
{
@@ -577,12 +576,12 @@ int main(int argc, char* argv[])
MERROR("Error opening database: " << e.what());
return 1;
}
r = core_storage[n]->init(db, net_type);
r = core_storage[n]->blockchain.init(db, net_type);
std::string source_dest = n == 0 ? "source" : "pruned";
CHECK_AND_ASSERT_MES(r, 1, "Failed to initialize " << source_dest << " blockchain storage");
MINFO(source_dest << " blockchain storage initialized OK");
if (n == 0 && core_storage[0]->get_blockchain_pruning_seed())
if (n == 0 && core_storage[0]->blockchain.get_blockchain_pruning_seed())
{
if (!opt_copy_pruned_database)
{
@@ -592,9 +591,9 @@ int main(int argc, char* argv[])
already_pruned = true;
}
}
core_storage[0]->deinit();
core_storage[0]->blockchain.deinit();
core_storage[0].reset(NULL);
core_storage[1]->deinit();
core_storage[1]->blockchain.deinit();
core_storage[1].reset(NULL);
MINFO("Pruning...");
@@ -160,9 +160,7 @@ int main(int argc, char* argv[])
const std::string input = command_line::get_arg(vm, arg_input);
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)
{
@@ -182,7 +180,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");
@@ -280,7 +278,7 @@ int main(int argc, char* argv[])
MINFO("Prunable outputs: " << num_prunable_outputs);
LOG_PRINT_L0("Blockchain known spent data pruned OK");
core_storage->deinit();
core_storage->blockchain.deinit();
return 0;
CATCH_ENTRY("Error", 1);
+9 -11
View File
@@ -1,4 +1,4 @@
// Copyright (c) 2014-2022, The Monero Project
// Copyright (c) 2014-2023, The Monero Project
//
// All rights reserved.
//
@@ -31,10 +31,9 @@
#include "common/command_line.h"
#include "common/varint.h"
#include "cryptonote_basic/cryptonote_boost_serialization.h"
#include "cryptonote_core/tx_pool.h"
#include "cryptonote_core/cryptonote_core.h"
#include "cryptonote_core/blockchain.h"
#include "blockchain_db/blockchain_db.h"
#include "time_helper.h"
#include "version.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
@@ -175,12 +174,12 @@ int main(int argc, char* argv[])
if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Salvium '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << desc_options << std::endl;
return 1;
}
mlog_configure(mlog_get_default_log_path("salvium-blockchain-stats.log"), true);
mlog_configure(mlog_get_default_log_path("monero-blockchain-stats.log"), true);
if (!command_line::is_arg_defaulted(vm, arg_log_level))
mlog_set_log(command_line::get_arg(vm, arg_log_level).c_str());
else
@@ -203,9 +202,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 +223,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");
@@ -242,7 +240,7 @@ int main(int argc, char* argv[])
/*
* The default output can be plotted with GnuPlot using these commands:
set key autotitle columnhead
set title "Salvium Blockchain Growth"
set title "Monero Blockchain Growth"
set timefmt "%Y-%m-%d"
set xdata time
set xrange ["2014-04-17":*]
@@ -381,7 +379,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);
@@ -151,9 +151,8 @@ int main(int argc, char* argv[])
// tx_memory_pool, Blockchain's constructor takes tx_memory_pool object.
LOG_PRINT_L0("Initializing source blockchain (BlockchainDB)");
const std::string input = command_line::get_arg(vm, arg_input);
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)
{
@@ -174,7 +173,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");
@@ -185,10 +184,10 @@ int main(int argc, char* argv[])
std::unordered_map<uint64_t,uint64_t> indices;
LOG_PRINT_L0("Reading blockchain from " << input);
core_storage->for_all_transactions([&](const crypto::hash &hash, const cryptonote::transaction &tx)->bool
core_storage->blockchain.for_all_transactions([&](const crypto::hash &hash, const cryptonote::transaction &tx)->bool
{
const bool coinbase = tx.vin.size() == 1 && tx.vin[0].type() == typeid(txin_gen);
const uint64_t height = core_storage->get_db().get_tx_block_height(hash);
const uint64_t height = core_storage->blockchain.get_db().get_tx_block_height(hash);
// create new outputs
for (const auto &out: tx.vout)