Compare commits

...

16 Commits

Author SHA1 Message Date
moneromooo-monero
5675d48bd4 Update to 0.11.0.1 2017-10-22 14:39:48 +01:00
ston1th
44a2b23b98 added fix for #2699
added logging info for WRITEMAP

WRITEMAP loggin info - better version
2017-10-22 14:27:54 +01:00
moneromooo-monero
2a32a25fa0 simplewallet: add get/set for refresh-from-height 2017-10-22 11:20:26 +01:00
landergate
c23bddeb17 wallet2: Missing underflow check on low heights
Lack of it results in `m_refresh_from_block_height` being < 0 (18446744...) on low heights, which blocks `process_new_blockchain_entry` and never process coins on heights less than blocks_per_month.
Follow-up to #2258
2017-10-22 11:20:14 +01:00
moneromooo-monero
bb11c91412 core: fix failure to sync when a tx is already in the pool 2017-10-22 11:19:53 +01:00
moneromooo-monero
5fd259d1d4 Source updates are in a source subdirectory
rather than in the same directory as the prebuilt versions
2017-10-22 11:19:37 +01:00
moneromooo-monero
f4c56980ae blockchain: fix crash checking pre-validated txids 2017-10-22 11:19:20 +01:00
moneromooo-monero
ca1e2fec78 db_lmdb: fix use of uninitialized key in for_blocks_range 2017-10-22 11:19:01 +01:00
Riccardo Spagni
15b0ff2c32 Merge pull request #2448
8133a642 p2p: init hashes after deserializing a network address (moneromooo-monero)
2017-09-25 17:58:43 +02:00
moneromooo-monero
8133a64260 p2p: init hashes after deserializing a network address
Fixes multiple connections to the same address
2017-09-14 17:51:37 +01:00
Riccardo Spagni
373ce4ab09 Merge pull request #2437
3deef401 core: guard against exceptions in tx verification worker threads (moneromooo-monero)
2017-09-12 13:12:28 +02:00
Riccardo Spagni
60a293df79 Merge pull request #2433
67bdf65c rpc: get_txpool_backlog is now unrestricted (moneromooo-monero)
2017-09-12 13:12:10 +02:00
Riccardo Spagni
3fd08bd37e Merge pull request #2423
bbb07f88 ITS#8728 fix MDB_VL32 freeing overflow page (Howard Chu)
2017-09-12 13:10:43 +02:00
moneromooo-monero
3deef4018e core: guard against exceptions in tx verification worker threads 2017-09-12 12:07:45 +01:00
moneromooo-monero
67bdf65cbf rpc: get_txpool_backlog is now unrestricted 2017-09-11 14:39:48 +01:00
Howard Chu
bbb07f8847 ITS#8728 fix MDB_VL32 freeing overflow page
Fix #2420
2017-09-09 15:14:22 +01:00
12 changed files with 92 additions and 22 deletions

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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.

View File

@@ -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

View File

@@ -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)

View File

@@ -59,6 +59,8 @@ namespace boost
{
a & na.m_ip;
a & na.m_port;
if (!typename Archive::is_saving())
na.init_ids();
}

View File

@@ -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")
{

View File

@@ -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()

View File

@@ -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;

View File

@@ -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);

View File

@@ -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

View File

@@ -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);