mirror of
https://github.com/monero-project/monero.git
synced 2025-12-07 13:20:53 -08:00
Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5675d48bd4 | ||
|
|
44a2b23b98 | ||
|
|
2a32a25fa0 | ||
|
|
c23bddeb17 | ||
|
|
bb11c91412 | ||
|
|
5fd259d1d4 | ||
|
|
f4c56980ae | ||
|
|
ca1e2fec78 | ||
|
|
15b0ff2c32 | ||
|
|
8133a64260 | ||
|
|
373ce4ab09 | ||
|
|
60a293df79 | ||
|
|
3fd08bd37e | ||
|
|
3deef4018e | ||
|
|
67bdf65cbf | ||
|
|
bbb07f8847 |
4
external/db_drivers/liblmdb/mdb.c
vendored
4
external/db_drivers/liblmdb/mdb.c
vendored
@@ -6288,6 +6288,10 @@ release:
|
||||
if (rc)
|
||||
return rc;
|
||||
}
|
||||
#ifdef MDB_VL32
|
||||
if (mc->mc_ovpg == mp)
|
||||
mc->mc_ovpg = NULL;
|
||||
#endif
|
||||
mc->mc_db->md_overflow_pages -= ovpages;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1117,6 +1117,12 @@ void BlockchainLMDB::open(const std::string& filename, const int db_flags)
|
||||
|
||||
m_folder = filename;
|
||||
|
||||
#ifdef __OpenBSD__
|
||||
if ((mdb_flags & MDB_WRITEMAP) == 0) {
|
||||
MCLOG_RED(el::Level::Info, "global", "Running on OpenBSD: forcing WRITEMAP");
|
||||
mdb_flags |= MDB_WRITEMAP;
|
||||
}
|
||||
#endif
|
||||
// set up lmdb environment
|
||||
if ((result = mdb_env_create(&m_env)))
|
||||
throw0(DB_ERROR(lmdb_error("Failed to create lmdb environment: ", result).c_str()));
|
||||
@@ -2420,8 +2426,8 @@ bool BlockchainLMDB::for_blocks_range(const uint64_t& h1, const uint64_t& h2, st
|
||||
MDB_cursor_op op;
|
||||
if (h1)
|
||||
{
|
||||
MDB_val_set(k, h1);
|
||||
op = MDB_SET;
|
||||
k = MDB_val{sizeof(h1), (void*)&h1};
|
||||
op = MDB_SET;
|
||||
} else
|
||||
{
|
||||
op = MDB_FIRST;
|
||||
|
||||
@@ -2242,6 +2242,24 @@ bool Blockchain::get_tx_outputs_gindexs(const crypto::hash& tx_id, std::vector<u
|
||||
return true;
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
void Blockchain::on_new_tx_from_block(const cryptonote::transaction &tx)
|
||||
{
|
||||
#if defined(PER_BLOCK_CHECKPOINT)
|
||||
// check if we're doing per-block checkpointing
|
||||
if (m_db->height() < m_blocks_hash_check.size())
|
||||
{
|
||||
TIME_MEASURE_START(a);
|
||||
m_blocks_txs_check.push_back(get_transaction_hash(tx));
|
||||
TIME_MEASURE_FINISH(a);
|
||||
if(m_show_time_stats)
|
||||
{
|
||||
size_t ring_size = tx.vin[0].type() == typeid(txin_to_key) ? boost::get<txin_to_key>(tx.vin[0]).key_offsets.size() : 0;
|
||||
MINFO("HASH: " << "-" << " I/M/O: " << tx.vin.size() << "/" << ring_size << "/" << tx.vout.size() << " H: " << 0 << " chcktx: " << a);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
//FIXME: it seems this function is meant to be merely a wrapper around
|
||||
// another function of the same name, this one adding one bit of
|
||||
// functionality. Should probably move anything more than that
|
||||
@@ -2257,19 +2275,10 @@ bool Blockchain::check_tx_inputs(transaction& tx, uint64_t& max_used_block_heigh
|
||||
|
||||
#if defined(PER_BLOCK_CHECKPOINT)
|
||||
// check if we're doing per-block checkpointing
|
||||
// FIXME: investigate why this block returns
|
||||
if (m_db->height() < m_blocks_hash_check.size() && kept_by_block)
|
||||
{
|
||||
TIME_MEASURE_START(a);
|
||||
m_blocks_txs_check.push_back(get_transaction_hash(tx));
|
||||
max_used_block_id = null_hash;
|
||||
max_used_block_height = 0;
|
||||
TIME_MEASURE_FINISH(a);
|
||||
if(m_show_time_stats)
|
||||
{
|
||||
size_t ring_size = tx.vin[0].type() == typeid(txin_to_key) ? boost::get<txin_to_key>(tx.vin[0]).key_offsets.size() : 0;
|
||||
MINFO("HASH: " << "-" << " I/M/O: " << tx.vin.size() << "/" << ring_size << "/" << tx.vout.size() << " H: " << 0 << " chcktx: " << a);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
@@ -3249,7 +3258,7 @@ leave:
|
||||
|
||||
// XXX old code adds miner tx here
|
||||
|
||||
int tx_index = 0;
|
||||
size_t tx_index = 0;
|
||||
// Iterate over the block's transaction hashes, grabbing each
|
||||
// from the tx_pool and validating them. Each is then added
|
||||
// to txs. Keys spent in each are added to <keys> by the double spend check.
|
||||
@@ -3331,7 +3340,7 @@ leave:
|
||||
{
|
||||
// ND: if fast_check is enabled for blocks, there is no need to check
|
||||
// the transaction inputs, but do some sanity checks anyway.
|
||||
if (memcmp(&m_blocks_txs_check[tx_index++], &tx_id, sizeof(tx_id)) != 0)
|
||||
if (tx_index >= m_blocks_txs_check.size() || memcmp(&m_blocks_txs_check[tx_index++], &tx_id, sizeof(tx_id)) != 0)
|
||||
{
|
||||
MERROR_VER("Block with id: " << id << " has at least one transaction (id: " << tx_id << ") with wrong inputs.");
|
||||
//TODO: why is this done? make sure that keeping invalid blocks makes sense.
|
||||
|
||||
@@ -898,6 +898,13 @@ namespace cryptonote
|
||||
|
||||
void cancel();
|
||||
|
||||
/**
|
||||
* @brief called when we see a tx originating from a block
|
||||
*
|
||||
* Used for handling txes from historical blocks in a fast way
|
||||
*/
|
||||
void on_new_tx_from_block(const cryptonote::transaction &tx);
|
||||
|
||||
private:
|
||||
|
||||
// TODO: evaluate whether or not each of these typedefs are left over from blockchain_storage
|
||||
|
||||
@@ -597,7 +597,15 @@ namespace cryptonote
|
||||
std::list<blobdata>::const_iterator it = tx_blobs.begin();
|
||||
for (size_t i = 0; i < tx_blobs.size(); i++, ++it) {
|
||||
region.run([&, i, it] {
|
||||
results[i].res = handle_incoming_tx_pre(*it, tvc[i], results[i].tx, results[i].hash, results[i].prefix_hash, keeped_by_block, relayed, do_not_relay);
|
||||
try
|
||||
{
|
||||
results[i].res = handle_incoming_tx_pre(*it, tvc[i], results[i].tx, results[i].hash, results[i].prefix_hash, keeped_by_block, relayed, do_not_relay);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
MERROR_VER("Exception in handle_incoming_tx_pre: " << e.what());
|
||||
results[i].res = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -617,7 +625,15 @@ namespace cryptonote
|
||||
else
|
||||
{
|
||||
region.run([&, i, it] {
|
||||
results[i].res = handle_incoming_tx_post(*it, tvc[i], results[i].tx, results[i].hash, results[i].prefix_hash, keeped_by_block, relayed, do_not_relay);
|
||||
try
|
||||
{
|
||||
results[i].res = handle_incoming_tx_post(*it, tvc[i], results[i].tx, results[i].hash, results[i].prefix_hash, keeped_by_block, relayed, do_not_relay);
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
MERROR_VER("Exception in handle_incoming_tx_post: " << e.what());
|
||||
results[i].res = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -880,6 +896,9 @@ namespace cryptonote
|
||||
//-----------------------------------------------------------------------------------------------
|
||||
bool core::add_new_tx(transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
||||
{
|
||||
if (keeped_by_block)
|
||||
get_blockchain_storage().on_new_tx_from_block(tx);
|
||||
|
||||
if(m_mempool.have_tx(tx_hash))
|
||||
{
|
||||
LOG_PRINT_L2("tx " << tx_hash << "already have transaction in tx_pool");
|
||||
@@ -1275,11 +1294,12 @@ namespace cryptonote
|
||||
bool core::check_updates()
|
||||
{
|
||||
static const char software[] = "monero";
|
||||
static const char subdir[] = "cli"; // because it can never be simple
|
||||
#ifdef BUILD_TAG
|
||||
static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
|
||||
static const char subdir[] = "cli"; // because it can never be simple
|
||||
#else
|
||||
static const char buildtag[] = "source";
|
||||
static const char subdir[] = "source"; // because it can never be simple
|
||||
#endif
|
||||
|
||||
if (check_updates_level == UPDATES_DISABLED)
|
||||
|
||||
@@ -59,6 +59,8 @@ namespace boost
|
||||
{
|
||||
a & na.m_ip;
|
||||
a & na.m_port;
|
||||
if (!typename Archive::is_saving())
|
||||
na.init_ids();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1560,8 +1560,10 @@ namespace cryptonote
|
||||
static const char software[] = "monero";
|
||||
#ifdef BUILD_TAG
|
||||
static const char buildtag[] = BOOST_PP_STRINGIZE(BUILD_TAG);
|
||||
static const char subdir[] = "cli";
|
||||
#else
|
||||
static const char buildtag[] = "source";
|
||||
static const char subdir[] = "source";
|
||||
#endif
|
||||
|
||||
if (req.command != "check" && req.command != "download" && req.command != "update")
|
||||
@@ -1584,8 +1586,8 @@ namespace cryptonote
|
||||
}
|
||||
res.update = true;
|
||||
res.version = version;
|
||||
res.user_uri = tools::get_update_url(software, "cli", buildtag, version, true);
|
||||
res.auto_uri = tools::get_update_url(software, "cli", buildtag, version, false);
|
||||
res.user_uri = tools::get_update_url(software, subdir, buildtag, version, true);
|
||||
res.auto_uri = tools::get_update_url(software, subdir, buildtag, version, false);
|
||||
res.hash = hash;
|
||||
if (req.command == "check")
|
||||
{
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace cryptonote
|
||||
MAP_JON_RPC_WE_IF("get_alternate_chains",on_get_alternate_chains, COMMAND_RPC_GET_ALTERNATE_CHAINS, !m_restricted)
|
||||
MAP_JON_RPC_WE_IF("relay_tx", on_relay_tx, COMMAND_RPC_RELAY_TX, !m_restricted)
|
||||
MAP_JON_RPC_WE_IF("sync_info", on_sync_info, COMMAND_RPC_SYNC_INFO, !m_restricted)
|
||||
MAP_JON_RPC_WE_IF("get_txpool_backlog", on_get_txpool_backlog, COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG, !m_restricted)
|
||||
MAP_JON_RPC_WE("get_txpool_backlog", on_get_txpool_backlog, COMMAND_RPC_GET_TRANSACTION_POOL_BACKLOG)
|
||||
END_JSON_RPC_MAP()
|
||||
END_URI_MAP2()
|
||||
|
||||
|
||||
@@ -716,6 +716,23 @@ bool simple_wallet::set_confirm_backlog(const std::vector<std::string> &args/* =
|
||||
return true;
|
||||
}
|
||||
|
||||
bool simple_wallet::set_refresh_from_block_height(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
||||
{
|
||||
const auto pwd_container = get_and_verify_password();
|
||||
if (pwd_container)
|
||||
{
|
||||
uint64_t height;
|
||||
if (!epee::string_tools::get_xtype_from_string(height, args[1]))
|
||||
{
|
||||
fail_msg_writer() << tr("Invalid height");
|
||||
return true;
|
||||
}
|
||||
m_wallet->set_refresh_from_block_height(height);
|
||||
m_wallet->rewrite(m_wallet_file, pwd_container->password());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool simple_wallet::help(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
||||
{
|
||||
success_msg_writer() << get_commands_str();
|
||||
@@ -756,7 +773,7 @@ simple_wallet::simple_wallet()
|
||||
m_cmd_binder.set_handler("viewkey", boost::bind(&simple_wallet::viewkey, this, _1), tr("Display private view key"));
|
||||
m_cmd_binder.set_handler("spendkey", boost::bind(&simple_wallet::spendkey, this, _1), tr("Display private spend key"));
|
||||
m_cmd_binder.set_handler("seed", boost::bind(&simple_wallet::seed, this, _1), tr("Display Electrum-style mnemonic seed"));
|
||||
m_cmd_binder.set_handler("set", boost::bind(&simple_wallet::set_variable, this, _1), tr("Available options: seed language - set wallet seed language; always-confirm-transfers <1|0> - whether to confirm unsplit txes; print-ring-members <1|0> - whether to print detailed information about ring members during confirmation; store-tx-info <1|0> - whether to store outgoing tx info (destination address, payment ID, tx secret key) for future reference; default-ring-size <n> - set default ring size (default is 5); auto-refresh <1|0> - whether to automatically sync new blocks from the daemon; refresh-type <full|optimize-coinbase|no-coinbase|default> - set wallet refresh behaviour; priority [0|1|2|3|4] - default/unimportant/normal/elevated/priority fee; confirm-missing-payment-id <1|0>; ask-password <1|0>; unit <monero|millinero|micronero|nanonero|piconero> - set default monero (sub-)unit; min-outputs-count [n] - try to keep at least that many outputs of value at least min-outputs-value; min-outputs-value [n] - try to keep at least min-outputs-count outputs of at least that value; merge-destinations <1|0> - whether to merge multiple payments to the same destination address; confirm-backlog <1|0> - whether to warn if there is transaction backlog"));
|
||||
m_cmd_binder.set_handler("set", boost::bind(&simple_wallet::set_variable, this, _1), tr("Available options: seed language - set wallet seed language; always-confirm-transfers <1|0> - whether to confirm unsplit txes; print-ring-members <1|0> - whether to print detailed information about ring members during confirmation; store-tx-info <1|0> - whether to store outgoing tx info (destination address, payment ID, tx secret key) for future reference; default-ring-size <n> - set default ring size (default is 5); auto-refresh <1|0> - whether to automatically sync new blocks from the daemon; refresh-type <full|optimize-coinbase|no-coinbase|default> - set wallet refresh behaviour; priority [0|1|2|3|4] - default/unimportant/normal/elevated/priority fee; confirm-missing-payment-id <1|0>; ask-password <1|0>; unit <monero|millinero|micronero|nanonero|piconero> - set default monero (sub-)unit; min-outputs-count [n] - try to keep at least that many outputs of value at least min-outputs-value; min-outputs-value [n] - try to keep at least min-outputs-count outputs of at least that value; merge-destinations <1|0> - whether to merge multiple payments to the same destination address; confirm-backlog <1|0> - whether to warn if there is transaction backlog; refresh-from-block-height [n] - set height before which to ignore blocks"));
|
||||
m_cmd_binder.set_handler("rescan_spent", boost::bind(&simple_wallet::rescan_spent, this, _1), tr("Rescan blockchain for spent outputs"));
|
||||
m_cmd_binder.set_handler("get_tx_key", boost::bind(&simple_wallet::get_tx_key, this, _1), tr("Get transaction key (r) for a given <txid>"));
|
||||
m_cmd_binder.set_handler("check_tx_key", boost::bind(&simple_wallet::check_tx_key, this, _1), tr("Check amount going to <address> in <txid>"));
|
||||
@@ -800,6 +817,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
|
||||
success_msg_writer() << "min-outputs-value = " << cryptonote::print_money(m_wallet->get_min_output_value());
|
||||
success_msg_writer() << "merge-destinations = " << m_wallet->merge_destinations();
|
||||
success_msg_writer() << "confirm-backlog = " << m_wallet->confirm_backlog();
|
||||
success_msg_writer() << "refresh-from-block-height = " << m_wallet->get_refresh_from_block_height();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -846,6 +864,7 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
|
||||
CHECK_SIMPLE_VARIABLE("min-outputs-value", set_min_output_value, tr("amount"));
|
||||
CHECK_SIMPLE_VARIABLE("merge-destinations", set_merge_destinations, tr("0 or 1"));
|
||||
CHECK_SIMPLE_VARIABLE("confirm-backlog", set_confirm_backlog, tr("0 or 1"));
|
||||
CHECK_SIMPLE_VARIABLE("refresh-from-block-height", set_refresh_from_block_height, tr("block height"));
|
||||
}
|
||||
fail_msg_writer() << tr("set: unrecognized argument(s)");
|
||||
return true;
|
||||
|
||||
@@ -121,6 +121,7 @@ namespace cryptonote
|
||||
bool set_min_output_value(const std::vector<std::string> &args = std::vector<std::string>());
|
||||
bool set_merge_destinations(const std::vector<std::string> &args = std::vector<std::string>());
|
||||
bool set_confirm_backlog(const std::vector<std::string> &args = std::vector<std::string>());
|
||||
bool set_refresh_from_block_height(const std::vector<std::string> &args = std::vector<std::string>());
|
||||
bool help(const std::vector<std::string> &args = std::vector<std::string>());
|
||||
bool start_mining(const std::vector<std::string> &args);
|
||||
bool stop_mining(const std::vector<std::string> &args);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define MONERO_VERSION_TAG "@VERSIONTAG@"
|
||||
#define MONERO_VERSION "0.11.0.0"
|
||||
#define MONERO_VERSION "0.11.0.1"
|
||||
#define MONERO_RELEASE_NAME "Helium Hydra"
|
||||
#define MONERO_VERSION_FULL MONERO_VERSION "-" MONERO_VERSION_TAG
|
||||
|
||||
@@ -2255,7 +2255,7 @@ crypto::secret_key wallet2::generate(const std::string& wallet_, const std::stri
|
||||
// Set blockchain height calculated from current date/time
|
||||
uint64_t approx_blockchain_height = get_approximate_blockchain_height();
|
||||
if(approx_blockchain_height > 0) {
|
||||
m_refresh_from_block_height = approx_blockchain_height - blocks_per_month;
|
||||
m_refresh_from_block_height = approx_blockchain_height >= blocks_per_month ? approx_blockchain_height - blocks_per_month : 0;
|
||||
}
|
||||
}
|
||||
bool r = store_keys(m_keys_file, password, false);
|
||||
|
||||
Reference in New Issue
Block a user