Skip to content

Commit

Permalink
Merge pull request #1 from uPlexa/Upgrades
Browse files Browse the repository at this point in the history
Upgrades to v0.1.9.4
  • Loading branch information
uPlexa committed Nov 25, 2018
2 parents bfa1955 + 94e6f07 commit 2955827
Show file tree
Hide file tree
Showing 30 changed files with 361 additions and 8,391 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ if (IOS)
endif()

cmake_minimum_required(VERSION 2.8.7)
message(STATUS "CMake version ${CMAKE_VERSION}")

project(uplexa)

Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ COPY . .
ENV USE_SINGLE_BUILDDIR=1
ARG NPROC
RUN set -ex && \
git submodule init && git submodule update && \
rm -rf build && \
if [ -z "$NPROC" ] ; \
then make -j$(nproc) release-static ; \
Expand All @@ -132,15 +133,14 @@ RUN set -ex && \
COPY --from=builder /src/build/release/bin /usr/local/bin/

# Contains the blockchain
VOLUME /root/.bitmonero
VOLUME /root/.uplexa

# Generate your wallet via accessing the container and run:
# cd /wallet
# monero-wallet-cli
# uplexa-wallet-cli
VOLUME /wallet

EXPOSE 18080
EXPOSE 18081

ENTRYPOINT ["monerod", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=18080", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=18081", "--non-interactive", "--confirm-external-bind"]
EXPOSE 21060
EXPOSE 21061

ENTRYPOINT ["uplexad", "--p2p-bind-ip=0.0.0.0", "--p2p-bind-port=21060", "--rpc-bind-ip=0.0.0.0", "--rpc-bind-port=21061", "--non-interactive", "--confirm-external-bind"]
4 changes: 3 additions & 1 deletion contrib/depends/toolchain.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ SET(CMAKE_BUILD_TYPE release)
SET(STATIC true)
SET(UNBOUND_STATIC true)

# where is the target environment
# where is the target environment
SET(CMAKE_FIND_ROOT_PATH @prefix@ /usr)

SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig)
Expand Down Expand Up @@ -51,7 +51,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(APPLE True)
SET(BUILD_TAG "mac-x64")
SET(BUILD_64 ON)
if(NOT TRAVIS)
SET(ARCH "x86_64")
endif()
SET(BREW OFF)
SET(PORT OFF)
SET(CMAKE_OSX_SYSROOT "@sdk@/MacOSX10.11.sdk/")
Expand Down
13 changes: 8 additions & 5 deletions contrib/epee/include/console_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,14 @@ namespace epee

std::string command;
bool get_line_ret = m_stdin_reader.get_line(command);
if (!m_running || m_stdin_reader.eos())
{
break;
}
if (!get_line_ret)
if (!m_running)
break;
if (m_stdin_reader.eos())
{
MGINFO("EOF on stdin, exiting");
break;
}
if (!get_line_ret)
{
MERROR("Failed to read line.");
}
Expand Down
35 changes: 35 additions & 0 deletions contrib/epee/src/mlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
#ifndef _MLOG_H_
#define _MLOG_H_

#ifdef _WIN32
#include <windows.h>
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
#endif

#include <time.h>
#include <atomic>
#include <boost/filesystem.hpp>
Expand Down Expand Up @@ -117,6 +124,31 @@ static const char *get_default_categories(int level)
return categories;
}

#ifdef WIN32
bool EnableVTMode()
{
// Set output mode to handle virtual terminal sequences
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
if (hOut == INVALID_HANDLE_VALUE)
{
return false;
}

DWORD dwMode = 0;
if (!GetConsoleMode(hOut, &dwMode))
{
return false;
}

dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
if (!SetConsoleMode(hOut, dwMode))
{
return false;
}
return true;
}
#endif

void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size, const std::size_t max_log_files)
{
el::Configurations c;
Expand Down Expand Up @@ -202,6 +234,9 @@ void mlog_configure(const std::string &filename_base, bool console, const std::s
monero_log = get_default_categories(0);
}
mlog_set_log(monero_log);
#ifdef WIN32
EnableVTMode();
#endif
}

void mlog_set_categories(const char *categories)
Expand Down
2 changes: 1 addition & 1 deletion src/blockchain_utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ target_link_libraries(blockchain_blackball

set_property(TARGET blockchain_blackball
PROPERTY
OUTPUT_NAME "uplexa-blockchain-blackball")
OUTPUT_NAME "uplexa-blockchain-mark-spent-outputs")
install(TARGETS blockchain_blackball DESTINATION bin)


Expand Down
30 changes: 15 additions & 15 deletions src/blockchain_utilities/blockchain_blackball.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ static void init(std::string cache_filename)
bool tx_active = false;
int dbr;

MINFO("Creating blackball cache in " << cache_filename);
MINFO("Creating spent output cache in " << cache_filename);

tools::create_directories_if_necessary(cache_filename);

Expand All @@ -240,7 +240,7 @@ static void init(std::string cache_filename)
CHECK_AND_ASSERT_THROW_MES(!dbr, "Failed to create LDMB environment: " + std::string(mdb_strerror(dbr)));
dbr = mdb_env_set_maxdbs(env, 6);
CHECK_AND_ASSERT_THROW_MES(!dbr, "Failed to set max env dbs: " + std::string(mdb_strerror(dbr)));
const std::string actual_filename = get_cache_filename(cache_filename);
const std::string actual_filename = get_cache_filename(cache_filename);
dbr = mdb_env_open(env, actual_filename.c_str(), flags, 0664);
CHECK_AND_ASSERT_THROW_MES(!dbr, "Failed to open rings database file '"
+ actual_filename + "': " + std::string(mdb_strerror(dbr)));
Expand Down Expand Up @@ -1019,7 +1019,7 @@ int main(int argc, char* argv[])
po::options_description desc_cmd_only("Command line options");
po::options_description desc_cmd_sett("Command line options and settings options");
const command_line::arg_descriptor<std::string> arg_blackball_db_dir = {
"blackball-db-dir", "Specify blackball database directory",
"spent-output-db-dir", "Specify spent output database directory",
get_default_db_path(),
};
const command_line::arg_descriptor<std::string> arg_log_level = {"log-level", "0-4 or categories", ""};
Expand All @@ -1032,7 +1032,7 @@ int main(int argc, char* argv[])
const command_line::arg_descriptor<std::vector<std::string> > arg_inputs = {"inputs", "Path to Monero DB, and path to any fork DBs"};
const command_line::arg_descriptor<std::string> arg_db_sync_mode = {
"db-sync-mode"
, "Specify sync option, using format [safe|fast|fastest]:[nrecords_per_sync]."
, "Specify sync option, using format [safe|fast|fastest]:[nrecords_per_sync]."
, "fast:1000"
};
const command_line::arg_descriptor<std::string> arg_extra_spent_list = {"extra-spent-list", "Optional list of known spent outputs",""};
Expand Down Expand Up @@ -1071,12 +1071,12 @@ int main(int argc, char* argv[])

if (command_line::get_arg(vm, command_line::arg_help))
{
std::cout << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << "uPlexa '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")" << ENDL << ENDL;
std::cout << desc_options << std::endl;
return 1;
}

mlog_configure(mlog_get_default_log_path("monero-blockchain-blackball.log"), true);
mlog_configure(mlog_get_default_log_path("uplexa-blockchain-find-spent-outputs.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
Expand Down Expand Up @@ -1114,10 +1114,10 @@ int main(int argc, char* argv[])
return 1;
}

const std::string cache_dir = (output_file_path / "blackball-cache").string();
const std::string cache_dir = (output_file_path / "spent-outputs-cache").string();
init(cache_dir);

LOG_PRINT_L0("Scanning for blackballable outputs...");
LOG_PRINT_L0("Scanning for spent outputs...");

size_t done = 0;

Expand Down Expand Up @@ -1215,7 +1215,7 @@ int main(int argc, char* argv[])
const std::pair<uint64_t, uint64_t> output = std::make_pair(txin.amount, absolute[0]);
if (opt_verbose)
{
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in a 1-ring");
MINFO("Marking output " << output.first << "/" << output.second << "as spent, due to being used in a 1-ring");
std::cout << "\r" << start_idx << "/" << n_txes << " \r" << std::flush;
}
blackballs.push_back(output);
Expand All @@ -1229,7 +1229,7 @@ int main(int argc, char* argv[])
const std::pair<uint64_t, uint64_t> output = std::make_pair(txin.amount, absolute[o]);
if (opt_verbose)
{
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in " << new_ring.size() << " identical " << new_ring.size() << "-rings");
MINFO("Marking output " << output.first << "/" << output.second << "as spent, due to being used in " << new_ring.size() << " identical " << new_ring.size() << "-rings");
std::cout << "\r" << start_idx << "/" << n_txes << " \r" << std::flush;
}
blackballs.push_back(output);
Expand All @@ -1244,7 +1244,7 @@ int main(int argc, char* argv[])
const std::pair<uint64_t, uint64_t> output = std::make_pair(txin.amount, absolute[o]);
if (opt_verbose)
{
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in " << new_ring.size() << " subsets of " << new_ring.size() << "-rings");
MINFO("Marking output " << output.first << "/" << output.second << "as spent, due to being used in " << new_ring.size() << " subsets of " << new_ring.size() << "-rings");
std::cout << "\r" << start_idx << "/" << n_txes << " \r" << std::flush;
}
blackballs.push_back(output);
Expand Down Expand Up @@ -1280,7 +1280,7 @@ int main(int argc, char* argv[])
const std::pair<uint64_t, uint64_t> output = std::make_pair(txin.amount, common[0]);
if (opt_verbose)
{
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in rings with a single common element");
MINFO("Marking output " << output.first << "/" << output.second << "as spent, due to being used in rings with a single common element");
std::cout << "\r" << start_idx << "/" << n_txes << " \r" << std::flush;
}
blackballs.push_back(output);
Expand Down Expand Up @@ -1392,7 +1392,7 @@ int main(int argc, char* argv[])
const std::pair<uint64_t, uint64_t> output = std::make_pair(od.amount, last_unknown);
if (opt_verbose)
{
MINFO("Blackballing output " << output.first << "/" << output.second << ", due to being used in a " <<
MINFO("Marking output " << output.first << "/" << output.second << "as spent, due to being used in a " <<
absolute.size() << "-ring where all other outputs are known to be spent");
}
blackballs.push_back(output);
Expand Down Expand Up @@ -1420,7 +1420,7 @@ int main(int argc, char* argv[])

skip_secondary_passes:
uint64_t diff = get_num_spent_outputs() - start_blackballed_outputs;
LOG_PRINT_L0(std::to_string(diff) << " new outputs blackballed, " << get_num_spent_outputs() << " total outputs blackballed");
LOG_PRINT_L0(std::to_string(diff) << " new outputs marked as spent, " << get_num_spent_outputs() << " total outputs marked as spent");

MDB_txn *txn;
dbr = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn);
Expand Down Expand Up @@ -1460,7 +1460,7 @@ int main(int argc, char* argv[])
mdb_txn_abort(txn);
}

LOG_PRINT_L0("Blockchain blackball data exported OK");
LOG_PRINT_L0("Blockchain spent output data exported OK");
close_db(env0, txn0, cur0, dbi0);
close();
return 0;
Expand Down
9 changes: 5 additions & 4 deletions src/common/expect.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace detail
// Shortens the characters in the places that `enable_if` is used below.
template<bool C>
using enable_if = typename std::enable_if<C>::type;

struct expect
{
//! \throw std::system_error with `ec`, optional `msg` and/or optional `file` + `line`.
Expand Down Expand Up @@ -306,7 +306,7 @@ class expect
//! \return Value, \pre `has_value()`.
T const& operator*() const noexcept { return get(); }

/*!
/*!
\note This function is `noexcept` when `U == T` is `noexcept`.
\return True if `has_value() == rhs.has_value()` and if values or errors are equal.
*/
Expand Down Expand Up @@ -350,7 +350,9 @@ class expect<void>
using error_type = std::error_code;

//! Create a successful object.
expect() = default;
expect() noexcept
: code_()
{}

expect(std::error_code const& code) noexcept
: code_(code)
Expand Down Expand Up @@ -444,4 +446,3 @@ namespace detail
throw_(result.error(), error_msg, file, line);
}
}

Loading

0 comments on commit 2955827

Please sign in to comment.