Compare commits
55 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29073f65e8 | |||
| f985d70f91 | |||
| d6da74ab5b | |||
| b3e053ad18 | |||
| ea723eeffa | |||
| 64c8981c1c | |||
| 4ad6b66283 | |||
| 1504424887 | |||
| 3a44fa2582 | |||
| 367cf3729b | |||
| 510d54edd7 | |||
| 37c6636199 | |||
| ca6b6ca0d3 | |||
| 6592d51693 | |||
| dc6da786d3 | |||
| effb22cfc4 | |||
| fea60d6ab2 | |||
| 14515ef230 | |||
| 742dec8d6a | |||
| 8d098ad508 | |||
| c28ea6b617 | |||
| d7ff707b52 | |||
| a23c80dfce | |||
| e4ce26c79f | |||
| 1e8a9d7dff | |||
| bd48280290 | |||
| 5638b07d9f | |||
| d661169c03 | |||
| 7ae3ebc7a8 | |||
| ccc7e3afae | |||
| 32ba6f3adb | |||
| 8e7baeb394 | |||
| e9fde8aa44 | |||
| dae5fcaabc | |||
| 5881bec7d6 | |||
| b66c523046 | |||
| 5f4e1fcc90 | |||
| 5f1e62115c | |||
| 6834ce6de2 | |||
| 8beb3cd2a1 | |||
| dc24639e64 | |||
| 92f42b1e81 | |||
| 29d7ef0fe0 | |||
| a9504f7001 | |||
| 3c36a6a227 | |||
| e3e1f83694 | |||
| 82037f2365 | |||
| 26e0cecb95 | |||
| b215ea9f56 | |||
| 067e232b19 | |||
| d7f3805d2e | |||
| a04d68f698 | |||
| 3b04e2e3d4 | |||
| e25d21a788 | |||
| 2509717b11 |
+1
-1
@@ -58,7 +58,7 @@ script:
|
||||
- export TRAVIS_COMMIT_LOG=`git log --format=fuller -1`
|
||||
- OUTDIR=$BASE_OUTDIR/$TRAVIS_PULL_REQUEST/$TRAVIS_JOB_NUMBER-$HOST
|
||||
- if [ -z "$NO_DEPENDS" ]; then $DOCKER_EXEC ccache --max-size=$CCACHE_SIZE; fi
|
||||
- $DOCKER_EXEC bash -c "mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/contrib/depends/$HOST/share/toolchain.cmake .. && make $MAKEJOBS"
|
||||
- $DOCKER_EXEC bash -c "mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/contrib/depends/$HOST/share/toolchain.cmake -DTRAVIS=true .. && make $MAKEJOBS"
|
||||
- export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/contrib/depends/$HOST/lib
|
||||
after_script:
|
||||
- echo $TRAVIS_COMMIT_RANGE
|
||||
|
||||
+3
-5
@@ -40,6 +40,7 @@ if (IOS)
|
||||
endif()
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.7)
|
||||
message(STATUS "CMake version ${CMAKE_VERSION}")
|
||||
|
||||
project(monero)
|
||||
|
||||
@@ -139,7 +140,6 @@ if(ARCH_ID STREQUAL "ppc64le")
|
||||
set(PPC64LE 1)
|
||||
set(PPC64 0)
|
||||
set(PPC 0)
|
||||
|
||||
endif()
|
||||
|
||||
if(ARCH_ID STREQUAL "powerpc64" OR ARCH_ID STREQUAL "ppc64")
|
||||
@@ -517,10 +517,8 @@ if(MSVC)
|
||||
include_directories(SYSTEM src/platform/msc)
|
||||
else()
|
||||
include(TestCXXAcceptsFlag)
|
||||
if (NOT ARM6)
|
||||
if(NOT DEPENDS OR DEPENDS AND NOT ARM)
|
||||
set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
|
||||
endif()
|
||||
if (NOT ARCH)
|
||||
set(ARCH native CACHE STRING "CPU to build for: -march value or 'default' to not pass -march at all")
|
||||
endif()
|
||||
message(STATUS "Building on ${CMAKE_SYSTEM_PROCESSOR} for ${ARCH}")
|
||||
if(ARCH STREQUAL "default")
|
||||
|
||||
@@ -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 ; \
|
||||
|
||||
@@ -179,7 +179,7 @@ invokes cmake commands as needed.
|
||||
* Change to the root of the source code directory, change to the most recent release branch, and build:
|
||||
|
||||
cd monero
|
||||
git checkout v0.13.0.0
|
||||
git checkout v0.13.0.4
|
||||
make
|
||||
|
||||
*Optional*: If your machine has several cores and enough memory, enable
|
||||
@@ -241,7 +241,7 @@ Tested on a Raspberry Pi Zero with a clean install of minimal Raspbian Stretch (
|
||||
```
|
||||
git clone https://github.com/monero-project/monero.git
|
||||
cd monero
|
||||
git checkout tags/v0.13.0.0
|
||||
git checkout tags/v0.13.0.4
|
||||
```
|
||||
* Build:
|
||||
```
|
||||
@@ -340,7 +340,7 @@ application.
|
||||
|
||||
* If you would like a specific [version/tag](https://github.com/monero-project/monero/tags), do a git checkout for that version. eg. 'v0.13.0.0'. If you dont care about the version and just want binaries from master, skip this step:
|
||||
|
||||
git checkout v0.13.0.0
|
||||
git checkout v0.13.0.4
|
||||
|
||||
* If you are on a 64-bit system, run:
|
||||
|
||||
|
||||
@@ -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/")
|
||||
|
||||
@@ -352,8 +352,11 @@ eof:
|
||||
|
||||
std::string command;
|
||||
bool get_line_ret = m_stdin_reader.get_line(command);
|
||||
if (!m_running || m_stdin_reader.eos())
|
||||
if (!m_running)
|
||||
break;
|
||||
if (m_stdin_reader.eos())
|
||||
{
|
||||
MGINFO("EOF on stdin, exiting");
|
||||
break;
|
||||
}
|
||||
if (!get_line_ret)
|
||||
|
||||
@@ -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>
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
|
||||
@@ -184,7 +184,7 @@ target_link_libraries(blockchain_blackball
|
||||
|
||||
set_property(TARGET blockchain_blackball
|
||||
PROPERTY
|
||||
OUTPUT_NAME "monero-blockchain-blackball")
|
||||
OUTPUT_NAME "monero-blockchain-mark-spent-outputs")
|
||||
install(TARGETS blockchain_blackball DESTINATION bin)
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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", ""};
|
||||
@@ -1076,7 +1076,7 @@ int main(int argc, char* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
mlog_configure(mlog_get_default_log_path("monero-blockchain-blackball.log"), true);
|
||||
mlog_configure(mlog_get_default_log_path("monero-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
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -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);
|
||||
@@ -1460,7 +1460,7 @@ skip_secondary_passes:
|
||||
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;
|
||||
|
||||
+3
-1
@@ -350,7 +350,9 @@ public:
|
||||
using error_type = std::error_code;
|
||||
|
||||
//! Create a successful object.
|
||||
expect() = default;
|
||||
expect() noexcept
|
||||
: code_()
|
||||
{}
|
||||
|
||||
expect(std::error_code const& code) noexcept
|
||||
: code_(code)
|
||||
|
||||
+13
-2
@@ -60,7 +60,7 @@ namespace
|
||||
|
||||
DWORD mode_old;
|
||||
::GetConsoleMode(h_cin, &mode_old);
|
||||
DWORD mode_new = mode_old & ~((hide_input ? ENABLE_ECHO_INPUT : 0) | ENABLE_LINE_INPUT);
|
||||
DWORD mode_new = mode_old & ~(hide_input ? ENABLE_ECHO_INPUT : 0);
|
||||
::SetConsoleMode(h_cin, mode_new);
|
||||
|
||||
bool r = true;
|
||||
@@ -78,7 +78,11 @@ namespace
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (ucs2_ch == L'\n' || ucs2_ch == L'\r')
|
||||
else if (ucs2_ch == L'\r')
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (ucs2_ch == L'\n')
|
||||
{
|
||||
std::cout << std::endl;
|
||||
break;
|
||||
@@ -158,6 +162,13 @@ namespace
|
||||
if (!aPass.empty())
|
||||
{
|
||||
aPass.pop_back();
|
||||
if (!hide_input)
|
||||
std::cout << "\b\b\b \b\b\b" << std::flush;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!hide_input)
|
||||
std::cout << "\b\b \b\b" << std::flush;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#endif
|
||||
|
||||
#include "misc_log_ex.h"
|
||||
#include "util.h"
|
||||
#include "spawn.h"
|
||||
|
||||
namespace tools
|
||||
@@ -101,6 +102,8 @@ int spawn(const char *filename, const std::vector<std::string>& args, bool wait)
|
||||
// child
|
||||
if (pid == 0)
|
||||
{
|
||||
tools::closefrom(3);
|
||||
close(0);
|
||||
char *envp[] = {NULL};
|
||||
execve(filename, argv, envp);
|
||||
MERROR("Failed to execve: " << strerror(errno));
|
||||
|
||||
+21
-1
@@ -28,6 +28,7 @@
|
||||
//
|
||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
|
||||
#ifdef __GLIBC__
|
||||
@@ -233,7 +234,7 @@ namespace tools
|
||||
MERROR("Failed to open " << filename << ": " << std::error_code(GetLastError(), std::system_category()));
|
||||
}
|
||||
#else
|
||||
m_fd = open(filename.c_str(), O_RDONLY | O_CREAT, 0666);
|
||||
m_fd = open(filename.c_str(), O_RDONLY | O_CREAT | O_CLOEXEC, 0666);
|
||||
if (m_fd != -1)
|
||||
{
|
||||
if (flock(m_fd, LOCK_EX | LOCK_NB) == -1)
|
||||
@@ -967,4 +968,23 @@ std::string get_nix_version_display_string()
|
||||
}
|
||||
#endif
|
||||
|
||||
void closefrom(int fd)
|
||||
{
|
||||
#if defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ || defined __DragonFly__
|
||||
::closefrom(fd);
|
||||
#else
|
||||
#if defined __GLIBC__
|
||||
const int sc_open_max = sysconf(_SC_OPEN_MAX);
|
||||
const int MAX_FDS = std::min(65536, sc_open_max);
|
||||
#else
|
||||
const int MAX_FDS = 65536;
|
||||
#endif
|
||||
while (fd < MAX_FDS)
|
||||
{
|
||||
close(fd);
|
||||
++fd;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -238,4 +238,6 @@ namespace tools
|
||||
#ifdef _WIN32
|
||||
std::string input_line_win();
|
||||
#endif
|
||||
|
||||
void closefrom(int fd);
|
||||
}
|
||||
|
||||
@@ -2364,7 +2364,7 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context
|
||||
const bool bulletproof = rct::is_rct_bulletproof(tx.rct_signatures.type);
|
||||
if (bulletproof || !tx.rct_signatures.p.bulletproofs.empty())
|
||||
{
|
||||
MERROR("Bulletproofs are not allowed before v8");
|
||||
MERROR_VER("Bulletproofs are not allowed before v8");
|
||||
tvc.m_invalid_output = true;
|
||||
return false;
|
||||
}
|
||||
@@ -2377,7 +2377,7 @@ bool Blockchain::check_tx_outputs(const transaction& tx, tx_verification_context
|
||||
const bool borromean = rct::is_rct_borromean(tx.rct_signatures.type);
|
||||
if (borromean)
|
||||
{
|
||||
MERROR("Borromean range proofs are not allowed after v8");
|
||||
MERROR_VER("Borromean range proofs are not allowed after v8");
|
||||
tvc.m_invalid_output = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -856,16 +856,19 @@ namespace cryptonote
|
||||
}
|
||||
waiter.wait(&tpool);
|
||||
it = tx_blobs.begin();
|
||||
std::vector<bool> already_have(tx_blobs.size(), false);
|
||||
for (size_t i = 0; i < tx_blobs.size(); i++, ++it) {
|
||||
if (!results[i].res)
|
||||
continue;
|
||||
if(m_mempool.have_tx(results[i].hash))
|
||||
{
|
||||
LOG_PRINT_L2("tx " << results[i].hash << "already have transaction in tx_pool");
|
||||
already_have[i] = true;
|
||||
}
|
||||
else if(m_blockchain_storage.have_tx(results[i].hash))
|
||||
{
|
||||
LOG_PRINT_L2("tx " << results[i].hash << " already have transaction in blockchain");
|
||||
already_have[i] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -887,7 +890,7 @@ namespace cryptonote
|
||||
std::vector<tx_verification_batch_info> tx_info;
|
||||
tx_info.reserve(tx_blobs.size());
|
||||
for (size_t i = 0; i < tx_blobs.size(); i++) {
|
||||
if (!results[i].res)
|
||||
if (!results[i].res || already_have[i])
|
||||
continue;
|
||||
tx_info.push_back({&results[i].tx, results[i].hash, tvc[i], results[i].res});
|
||||
}
|
||||
@@ -897,6 +900,8 @@ namespace cryptonote
|
||||
bool ok = true;
|
||||
it = tx_blobs.begin();
|
||||
for (size_t i = 0; i < tx_blobs.size(); i++, ++it) {
|
||||
if (already_have[i])
|
||||
continue;
|
||||
if (!results[i].res)
|
||||
{
|
||||
ok = false;
|
||||
|
||||
+13
-1
@@ -136,7 +136,19 @@ bool t_daemon::run(bool interactive)
|
||||
{
|
||||
throw std::runtime_error{"Can't run stopped daemon"};
|
||||
}
|
||||
tools::signal_handler::install(std::bind(&daemonize::t_daemon::stop_p2p, this));
|
||||
|
||||
std::atomic<bool> stop(false), shutdown(false);
|
||||
boost::thread stop_thread = boost::thread([&stop, &shutdown, this] {
|
||||
while (!stop)
|
||||
epee::misc_utils::sleep_no_w(100);
|
||||
if (shutdown)
|
||||
this->stop_p2p();
|
||||
});
|
||||
epee::misc_utils::auto_scope_leave_caller scope_exit_handler = epee::misc_utils::create_scope_leave_handler([&](){
|
||||
stop = true;
|
||||
stop_thread.join();
|
||||
});
|
||||
tools::signal_handler::install([&stop, &shutdown](int){ stop = shutdown = true; });
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace hw {
|
||||
this->connect(p->vid, p->pid, p->interface_number, p->usage_page, p->interface_OR_page);
|
||||
}
|
||||
|
||||
void device_io_hid::connect(unsigned int vid, unsigned int pid, unsigned int interface_number, unsigned int usage_page, bool interface_OR_page ) {
|
||||
void device_io_hid::connect(unsigned int vid, unsigned int pid, int interface_number, unsigned short usage_page, bool interface_OR_page ) {
|
||||
hid_device_info *hwdev_info, *hwdev_info_list;
|
||||
hid_device *hwdev;
|
||||
|
||||
@@ -83,8 +83,8 @@ namespace hw {
|
||||
hwdev = NULL;
|
||||
hwdev_info = hwdev_info_list;
|
||||
while (hwdev_info) {
|
||||
if ((interface_OR_page && ((usage_page == 0xffa0) || (interface_number == 0))) ||
|
||||
((usage_page == 0xffa0) && (interface_number == 0)) ) {
|
||||
if ((interface_OR_page && ((hwdev_info->usage_page == usage_page) || (hwdev_info->interface_number == interface_number))) ||
|
||||
((hwdev_info->usage_page == usage_page) && (hwdev_info->interface_number == interface_number))) {
|
||||
MDEBUG("HID Device found: " << safe_hid_path(hwdev_info));
|
||||
hwdev = hid_open_path(hwdev_info->path);
|
||||
break;
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace hw {
|
||||
struct hid_conn_params {
|
||||
unsigned int vid;
|
||||
unsigned int pid;
|
||||
unsigned int interface_number;
|
||||
unsigned int usage_page;
|
||||
int interface_number;
|
||||
unsigned short usage_page;
|
||||
bool interface_OR_page ;
|
||||
};
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace hw {
|
||||
|
||||
void init();
|
||||
void connect(void *params);
|
||||
void connect(unsigned int vid, unsigned int pid, unsigned int interface_number, unsigned int usage_page, bool interface_OR_page );
|
||||
void connect(unsigned int vid, unsigned int pid, int interface_number, unsigned short usage_page, bool interface_OR_page );
|
||||
bool connected() const;
|
||||
int exchange(unsigned char *command, unsigned int cmd_len, unsigned char *response, unsigned int max_resp_len);
|
||||
void disconnect();
|
||||
|
||||
@@ -937,7 +937,7 @@ namespace nodetool
|
||||
bool res = m_net_server.connect(epee::string_tools::get_ip_string_from_int32(ipv4.ip()),
|
||||
epee::string_tools::num_to_string_fast(ipv4.port()),
|
||||
m_config.m_net_config.connection_timeout,
|
||||
con, m_bind_ip.empty() ? "0.0.0.0" : m_bind_ip);
|
||||
con);
|
||||
|
||||
if(!res)
|
||||
{
|
||||
@@ -1002,7 +1002,7 @@ namespace nodetool
|
||||
bool res = m_net_server.connect(epee::string_tools::get_ip_string_from_int32(ipv4.ip()),
|
||||
epee::string_tools::num_to_string_fast(ipv4.port()),
|
||||
m_config.m_net_config.connection_timeout,
|
||||
con, m_bind_ip.empty() ? "0.0.0.0" : m_bind_ip);
|
||||
con);
|
||||
|
||||
if (!res) {
|
||||
bool is_priority = is_priority_node(na);
|
||||
@@ -1617,7 +1617,7 @@ namespace nodetool
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}, m_bind_ip.empty() ? "0.0.0.0" : m_bind_ip);
|
||||
});
|
||||
if(!r)
|
||||
{
|
||||
LOG_WARNING_CC(context, "Failed to call connect_async, network error.");
|
||||
|
||||
@@ -924,6 +924,8 @@ namespace cryptonote
|
||||
return r;
|
||||
|
||||
m_core.get_pool_transactions_and_spent_keys_info(res.transactions, res.spent_key_images, !request_has_rpc_origin || !m_restricted);
|
||||
for (tx_info& txi : res.transactions)
|
||||
txi.tx_blob = epee::string_tools::buff_to_hex_nodelimer(txi.tx_blob);
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
}
|
||||
@@ -2118,6 +2120,8 @@ namespace cryptonote
|
||||
|
||||
try
|
||||
{
|
||||
// 0 is placeholder for the whole chain
|
||||
const uint64_t req_to_height = req.to_height ? req.to_height : (m_core.get_current_blockchain_height() - 1);
|
||||
for (uint64_t amount: req.amounts)
|
||||
{
|
||||
static struct D
|
||||
@@ -2130,7 +2134,7 @@ namespace cryptonote
|
||||
} d;
|
||||
boost::unique_lock<boost::mutex> lock(d.mutex);
|
||||
|
||||
if (d.cached && amount == 0 && d.cached_from == req.from_height && d.cached_to == req.to_height)
|
||||
if (d.cached && amount == 0 && d.cached_from == req.from_height && d.cached_to == req_to_height)
|
||||
{
|
||||
res.distributions.push_back({amount, d.cached_start_height, req.binary, d.cached_distribution, d.cached_base});
|
||||
if (!req.cumulative)
|
||||
@@ -2145,23 +2149,23 @@ namespace cryptonote
|
||||
|
||||
std::vector<uint64_t> distribution;
|
||||
uint64_t start_height, base;
|
||||
if (!m_core.get_output_distribution(amount, req.from_height, req.to_height, start_height, distribution, base))
|
||||
if (!m_core.get_output_distribution(amount, req.from_height, req_to_height, start_height, distribution, base))
|
||||
{
|
||||
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
|
||||
error_resp.message = "Failed to get rct distribution";
|
||||
return false;
|
||||
}
|
||||
if (req.to_height > 0 && req.to_height >= req.from_height)
|
||||
if (req_to_height > 0 && req_to_height >= req.from_height)
|
||||
{
|
||||
uint64_t offset = std::max(req.from_height, start_height);
|
||||
if (offset <= req.to_height && req.to_height - offset + 1 < distribution.size())
|
||||
distribution.resize(req.to_height - offset + 1);
|
||||
if (offset <= req_to_height && req_to_height - offset + 1 < distribution.size())
|
||||
distribution.resize(req_to_height - offset + 1);
|
||||
}
|
||||
|
||||
if (amount == 0)
|
||||
{
|
||||
d.cached_from = req.from_height;
|
||||
d.cached_to = req.to_height;
|
||||
d.cached_to = req_to_height;
|
||||
d.cached_distribution = distribution;
|
||||
d.cached_start_height = start_height;
|
||||
d.cached_base = base;
|
||||
|
||||
@@ -1640,7 +1640,7 @@ bool simple_wallet::blackball(const std::vector<std::string> &args)
|
||||
uint64_t amount = std::numeric_limits<uint64_t>::max(), offset, num_offsets;
|
||||
if (args.size() == 0)
|
||||
{
|
||||
fail_msg_writer() << tr("usage: blackball <amount>/<offset> | <filename> [add]");
|
||||
fail_msg_writer() << tr("usage: mark_output_spent <amount>/<offset> | <filename> [add]");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1718,7 +1718,7 @@ bool simple_wallet::blackball(const std::vector<std::string> &args)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
fail_msg_writer() << tr("Failed to blackball output: ") << e.what();
|
||||
fail_msg_writer() << tr("Failed to mark output spent: ") << e.what();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1729,7 +1729,7 @@ bool simple_wallet::unblackball(const std::vector<std::string> &args)
|
||||
std::pair<uint64_t, uint64_t> output;
|
||||
if (args.size() != 1)
|
||||
{
|
||||
fail_msg_writer() << tr("usage: unblackball <amount>/<offset>");
|
||||
fail_msg_writer() << tr("usage: mark_output_unspent <amount>/<offset>");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1745,7 +1745,7 @@ bool simple_wallet::unblackball(const std::vector<std::string> &args)
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
fail_msg_writer() << tr("Failed to unblackball output: ") << e.what();
|
||||
fail_msg_writer() << tr("Failed to mark output unspent: ") << e.what();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -1756,7 +1756,7 @@ bool simple_wallet::blackballed(const std::vector<std::string> &args)
|
||||
std::pair<uint64_t, uint64_t> output;
|
||||
if (args.size() != 1)
|
||||
{
|
||||
fail_msg_writer() << tr("usage: blackballed <amount>/<offset>");
|
||||
fail_msg_writer() << tr("usage: is_output_spent <amount>/<offset>");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1769,13 +1769,13 @@ bool simple_wallet::blackballed(const std::vector<std::string> &args)
|
||||
try
|
||||
{
|
||||
if (m_wallet->is_output_blackballed(output))
|
||||
message_writer() << tr("Blackballed: ") << output.first << "/" << output.second;
|
||||
message_writer() << tr("Spent: ") << output.first << "/" << output.second;
|
||||
else
|
||||
message_writer() << tr("not blackballed: ") << output.first << "/" << output.second;
|
||||
message_writer() << tr("Not spent: ") << output.first << "/" << output.second;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
fail_msg_writer() << tr("Failed to unblackball output: ") << e.what();
|
||||
fail_msg_writer() << tr("Failed to check whether output is spent: ") << e.what();
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -2403,7 +2403,7 @@ simple_wallet::simple_wallet()
|
||||
"store-tx-info <1|0>\n "
|
||||
" Whether to store outgoing tx info (destination address, payment ID, tx secret key) for future reference.\n "
|
||||
"default-ring-size <n>\n "
|
||||
" Set the default ring size (default and minimum is 5).\n "
|
||||
" Set the default ring size (obsolete).\n "
|
||||
"auto-refresh <1|0>\n "
|
||||
" Whether to automatically synchronize new blocks from the daemon.\n "
|
||||
"refresh-type <full|optimize-coinbase|no-coinbase|default>\n "
|
||||
@@ -2599,18 +2599,18 @@ simple_wallet::simple_wallet()
|
||||
boost::bind(&simple_wallet::save_known_rings, this, _1),
|
||||
tr("save_known_rings"),
|
||||
tr("Save known rings to the shared rings database"));
|
||||
m_cmd_binder.set_handler("blackball",
|
||||
m_cmd_binder.set_handler("mark_output_spent",
|
||||
boost::bind(&simple_wallet::blackball, this, _1),
|
||||
tr("blackball <amount>/<offset> | <filename> [add]"),
|
||||
tr("Blackball output(s) so they never get selected as fake outputs in a ring"));
|
||||
m_cmd_binder.set_handler("unblackball",
|
||||
tr("mark_output_spent <amount>/<offset> | <filename> [add]"),
|
||||
tr("Mark output(s) as spent so they never get selected as fake outputs in a ring"));
|
||||
m_cmd_binder.set_handler("mark_output_unspent",
|
||||
boost::bind(&simple_wallet::unblackball, this, _1),
|
||||
tr("unblackball <amount>/<offset>"),
|
||||
tr("Unblackballs an output so it may get selected as a fake output in a ring"));
|
||||
m_cmd_binder.set_handler("blackballed",
|
||||
tr("mark_output_unspent <amount>/<offset>"),
|
||||
tr("Marks an output as unspent so it may get selected as a fake output in a ring"));
|
||||
m_cmd_binder.set_handler("is_output_spent",
|
||||
boost::bind(&simple_wallet::blackballed, this, _1),
|
||||
tr("blackballed <amount>/<offset>"),
|
||||
tr("Checks whether an output is blackballed"));
|
||||
tr("is_output_spent <amount>/<offset>"),
|
||||
tr("Checks whether an output is marked as spent"));
|
||||
m_cmd_binder.set_handler("version",
|
||||
boost::bind(&simple_wallet::version, this, _1),
|
||||
tr("version"),
|
||||
@@ -3032,7 +3032,7 @@ bool simple_wallet::init(const boost::program_options::variables_map& vm)
|
||||
return false;
|
||||
}
|
||||
crypto::secret_key viewkey;
|
||||
if (viewkey_string.hex_to_pod(unwrap(unwrap(viewkey))))
|
||||
if (!viewkey_string.hex_to_pod(unwrap(unwrap(viewkey))))
|
||||
{
|
||||
fail_msg_writer() << tr("failed to parse view key secret key");
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#define DEF_MONERO_VERSION_TAG "@VERSIONTAG@"
|
||||
#define DEF_MONERO_VERSION "0.13.0.2"
|
||||
#define DEF_MONERO_VERSION "0.13.0.4"
|
||||
#define DEF_MONERO_RELEASE_NAME "Beryllium Bullet"
|
||||
#define DEF_MONERO_VERSION_FULL DEF_MONERO_VERSION "-" DEF_MONERO_VERSION_TAG
|
||||
|
||||
|
||||
@@ -776,7 +776,7 @@ bool WalletImpl::setPassword(const std::string &password)
|
||||
{
|
||||
clearStatus();
|
||||
try {
|
||||
m_wallet->rewrite(m_wallet->get_wallet_file(), password);
|
||||
m_wallet->change_password(m_wallet->get_wallet_file(), m_password, password);
|
||||
m_password = password;
|
||||
} catch (const std::exception &e) {
|
||||
setStatusError(e.what());
|
||||
@@ -2161,7 +2161,7 @@ bool WalletImpl::blackballOutputs(const std::vector<std::string> &outputs, bool
|
||||
bool ret = m_wallet->set_blackballed_outputs(raw_outputs, add);
|
||||
if (!ret)
|
||||
{
|
||||
setStatusError(tr("Failed to set blackballed outputs"));
|
||||
setStatusError(tr("Failed to mark outputs as spent"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -2183,7 +2183,7 @@ bool WalletImpl::blackballOutput(const std::string &amount, const std::string &o
|
||||
bool ret = m_wallet->blackball_output(std::make_pair(raw_amount, raw_offset));
|
||||
if (!ret)
|
||||
{
|
||||
setStatusError(tr("Failed to blackball output"));
|
||||
setStatusError(tr("Failed to mark output as spent"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -2205,7 +2205,7 @@ bool WalletImpl::unblackballOutput(const std::string &amount, const std::string
|
||||
bool ret = m_wallet->unblackball_output(std::make_pair(raw_amount, raw_offset));
|
||||
if (!ret)
|
||||
{
|
||||
setStatusError(tr("Failed to unblackball output"));
|
||||
setStatusError(tr("Failed to mark output as unspent"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -412,13 +412,13 @@ bool ringdb::blackball_worker(const std::vector<std::pair<uint64_t, uint64_t>> &
|
||||
switch (op)
|
||||
{
|
||||
case BLACKBALL_BLACKBALL:
|
||||
MDEBUG("Blackballing output " << output.first << "/" << output.second);
|
||||
MDEBUG("Marking output " << output.first << "/" << output.second << " as spent");
|
||||
dbr = mdb_cursor_put(cursor, &key, &data, MDB_APPENDDUP);
|
||||
if (dbr == MDB_KEYEXIST)
|
||||
dbr = 0;
|
||||
break;
|
||||
case BLACKBALL_UNBLACKBALL:
|
||||
MDEBUG("Unblackballing output " << output.first << "/" << output.second);
|
||||
MDEBUG("Marking output " << output.first << "/" << output.second << " as unspent");
|
||||
dbr = mdb_cursor_get(cursor, &key, &data, MDB_GET_BOTH);
|
||||
if (dbr == 0)
|
||||
dbr = mdb_cursor_del(cursor, 0);
|
||||
|
||||
+25
-3
@@ -121,6 +121,8 @@ using namespace cryptonote;
|
||||
|
||||
#define FIRST_REFRESH_GRANULARITY 1024
|
||||
|
||||
#define GAMMA_PICK_HALF_WINDOW 5
|
||||
|
||||
static const std::string MULTISIG_SIGNATURE_MAGIC = "SigMultisigPkV1";
|
||||
static const std::string MULTISIG_EXTRA_INFO_MAGIC = "MultisigxV1";
|
||||
|
||||
@@ -3611,6 +3613,7 @@ bool wallet2::query_device(hw::device::device_type& device_type, const std::stri
|
||||
if (json.Parse(account_data.c_str()).HasParseError() || !json.IsObject())
|
||||
crypto::chacha8(keys_file_data.account_data.data(), keys_file_data.account_data.size(), key, keys_file_data.iv, &account_data[0]);
|
||||
|
||||
device_type = hw::device::device_type::SOFTWARE;
|
||||
// The contents should be JSON if the wallet follows the new format.
|
||||
if (json.Parse(account_data.c_str()).HasParseError())
|
||||
{
|
||||
@@ -6792,10 +6795,29 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
|
||||
error::get_output_distribution, "Decreasing offsets in rct distribution: " +
|
||||
std::to_string(block_offset) + ": " + std::to_string(rct_offsets[block_offset]) + ", " +
|
||||
std::to_string(block_offset + 1) + ": " + std::to_string(rct_offsets[block_offset + 1]));
|
||||
uint64_t n_rct = rct_offsets[block_offset + 1] - rct_offsets[block_offset];
|
||||
uint64_t first_block_offset = block_offset, last_block_offset = block_offset;
|
||||
for (size_t half_window = 0; half_window < GAMMA_PICK_HALF_WINDOW; ++half_window)
|
||||
{
|
||||
// end when we have a non empty block
|
||||
uint64_t cum0 = first_block_offset > 0 ? rct_offsets[first_block_offset] - rct_offsets[first_block_offset - 1] : rct_offsets[0];
|
||||
if (cum0 > 1)
|
||||
break;
|
||||
uint64_t cum1 = last_block_offset > 0 ? rct_offsets[last_block_offset] - rct_offsets[last_block_offset - 1] : rct_offsets[0];
|
||||
if (cum1 > 1)
|
||||
break;
|
||||
if (first_block_offset == 0 && last_block_offset >= rct_offsets.size() - 2)
|
||||
break;
|
||||
// expand up to bounds
|
||||
if (first_block_offset > 0)
|
||||
--first_block_offset;
|
||||
if (last_block_offset < rct_offsets.size() - 1)
|
||||
++last_block_offset;
|
||||
}
|
||||
const uint64_t n_rct = rct_offsets[last_block_offset] - (first_block_offset == 0 ? 0 : rct_offsets[first_block_offset - 1]);
|
||||
if (n_rct == 0)
|
||||
return rct_offsets[block_offset] ? rct_offsets[block_offset] - 1 : 0;
|
||||
return rct_offsets[block_offset] + crypto::rand<uint64_t>() % n_rct;
|
||||
MDEBUG("Picking 1/" << n_rct << " in " << (last_block_offset - first_block_offset + 1) << " blocks centered around " << block_offset);
|
||||
return rct_offsets[first_block_offset] + crypto::rand<uint64_t>() % n_rct;
|
||||
};
|
||||
|
||||
size_t num_selected_transfers = 0;
|
||||
@@ -6979,7 +7001,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
|
||||
// outputs, we still need to reach the minimum ring size)
|
||||
if (allow_blackballed)
|
||||
break;
|
||||
MINFO("Not enough non blackballed outputs, we'll allow blackballed ones");
|
||||
MINFO("Not enough output not marked as spent, we'll allow outputs marked as spent");
|
||||
allow_blackballed = true;
|
||||
num_usable_outs = num_outs;
|
||||
}
|
||||
|
||||
@@ -2822,8 +2822,7 @@ namespace tools
|
||||
{
|
||||
try
|
||||
{
|
||||
m_wallet->rewrite(m_wallet->get_wallet_file(), req.new_password);
|
||||
m_wallet->store();
|
||||
m_wallet->change_password(m_wallet->get_wallet_file(), req.old_password, req.new_password);
|
||||
LOG_PRINT_L0("Wallet password changed.");
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
||||
@@ -136,21 +136,21 @@ TEST(ringdb, different_genesis)
|
||||
ASSERT_FALSE(ringdb.get_ring(KEY_2, KEY_IMAGE_1, outs2));
|
||||
}
|
||||
|
||||
TEST(blackball, not_found)
|
||||
TEST(spent_outputs, not_found)
|
||||
{
|
||||
RingDB ringdb;
|
||||
ASSERT_TRUE(ringdb.blackball(OUTPUT_1));
|
||||
ASSERT_FALSE(ringdb.blackballed(OUTPUT_2));
|
||||
}
|
||||
|
||||
TEST(blackball, found)
|
||||
TEST(spent_outputs, found)
|
||||
{
|
||||
RingDB ringdb;
|
||||
ASSERT_TRUE(ringdb.blackball(OUTPUT_1));
|
||||
ASSERT_TRUE(ringdb.blackballed(OUTPUT_1));
|
||||
}
|
||||
|
||||
TEST(blackball, vector)
|
||||
TEST(spent_outputs, vector)
|
||||
{
|
||||
RingDB ringdb;
|
||||
std::vector<std::pair<uint64_t, uint64_t>> outputs;
|
||||
@@ -174,7 +174,7 @@ TEST(blackball, vector)
|
||||
ASSERT_TRUE(ringdb.blackballed(std::make_pair(30, 5)));
|
||||
}
|
||||
|
||||
TEST(blackball, unblackball)
|
||||
TEST(spent_outputs, mark_as_unspent)
|
||||
{
|
||||
RingDB ringdb;
|
||||
ASSERT_TRUE(ringdb.blackball(OUTPUT_1));
|
||||
@@ -182,7 +182,7 @@ TEST(blackball, unblackball)
|
||||
ASSERT_FALSE(ringdb.blackballed(OUTPUT_1));
|
||||
}
|
||||
|
||||
TEST(blackball, clear)
|
||||
TEST(spent_outputs, clear)
|
||||
{
|
||||
RingDB ringdb;
|
||||
ASSERT_TRUE(ringdb.blackball(OUTPUT_1));
|
||||
|
||||
Reference in New Issue
Block a user