Compare commits

...

55 Commits

Author SHA1 Message Date
Riccardo Spagni 29073f65e8 Merge pull request #4705
f985d70f wallet2: extend fake out picks away from the gamma pick (moneromooo-monero)
2018-10-23 18:04:12 +02:00
moneromooo-monero f985d70f91 wallet2: extend fake out picks away from the gamma pick
in order to unbias selection from blocks with few txes
2018-10-23 09:56:32 +00:00
Riccardo Spagni d6da74ab5b Merge pull request #4698
ea723eef update version to 0.13.0.4 (Riccardo Spagni)
2018-10-22 23:27:02 +02:00
Riccardo Spagni b3e053ad18 Merge pull request #4696
64c8981c Providing user supplied default constructor for expect<void> (Lee Clagett)
2018-10-22 23:26:23 +02:00
Riccardo Spagni ea723eeffa update version to 0.13.0.4 2018-10-22 23:10:58 +02:00
Lee Clagett 64c8981c1c Providing user supplied default constructor for expect<void> 2018-10-22 15:39:10 +00:00
Riccardo Spagni 4ad6b66283 Merge pull request #4670
fea60d6a console_handler: add a global log when exiting via EOF (moneromooo-monero)
2018-10-20 20:45:14 +02:00
Riccardo Spagni 1504424887 Merge pull request #4667
14515ef2 blockchain: move two new verification errors to the verify category (moneromooo-monero)
2018-10-20 20:44:38 +02:00
Riccardo Spagni 3a44fa2582 Merge pull request #4660
742dec8d rpc: fix output distribution caching ignoring chain changes (moneromooo-monero)
2018-10-20 20:44:04 +02:00
Riccardo Spagni 367cf3729b Merge pull request #4643
c28ea6b6 device: fixed Ledger Nano S device selection (xiphon)
2018-10-20 20:43:46 +02:00
Riccardo Spagni 510d54edd7 Merge pull request #4651
8d098ad5 Rename "blackball" for clarity (moneromooo-monero)
2018-10-20 20:43:28 +02:00
Riccardo Spagni 37c6636199 Merge pull request #4638
a23c80df core: don't verify range proofs multiple times (moneromooo-monero)
2018-10-20 20:43:09 +02:00
Riccardo Spagni ca6b6ca0d3 Merge pull request #4636
d7ff707b tx_pool: revert #4592 and move bin2hex conversion to on_get_transaction_pool (stoffu)
2018-10-20 20:42:51 +02:00
Riccardo Spagni 6592d51693 Merge pull request #4632
1e8a9d7d ANSI colors in Windows 10 (v0.13) (iDunk5400)
2018-10-20 20:42:24 +02:00
Riccardo Spagni dc6da786d3 Merge pull request #4630
e4ce26c7 spawn: close all file descriptors before execve (moneromooo-monero)
2018-10-20 20:42:05 +02:00
Riccardo Spagni effb22cfc4 Merge pull request #4627
bd482802 util: close keys file lock on exec (moneromooo-monero)
2018-10-20 20:41:45 +02:00
moneromooo-monero fea60d6ab2 console_handler: add a global log when exiting via EOF
It's a common confusion point for users which run monerod
without stdin and with --detach
2018-10-20 09:14:08 +00:00
moneromooo-monero 14515ef230 blockchain: move two new verification errors to the verify category
Lest we get people get scared again
2018-10-19 21:11:31 +00:00
moneromooo-monero 742dec8d6a rpc: fix output distribution caching ignoring chain changes
0 is placeholder for whole chain, so we should compare chain
height changes rather than chain-height-or-zero. Even this isn't
totally foolproof if a blocks are popped and the same number
added again, but it is much better as it prevents the data from
slowly going out of sync.
2018-10-19 09:22:59 +00:00
moneromooo-monero 8d098ad508 Rename "blackball" for clarity
Apparently some people seem to think it's a censorship list...
2018-10-18 18:46:17 +00:00
xiphon c28ea6b617 device: fixed Ledger Nano S device selection 2018-10-18 04:37:30 +00:00
stoffu d7ff707b52 tx_pool: revert #4592 and move bin2hex conversion to on_get_transaction_pool 2018-10-18 10:10:36 +09:00
moneromooo-monero a23c80dfce core: don't verify range proofs multiple times 2018-10-17 16:23:31 +00:00
moneromooo-monero e4ce26c79f spawn: close all file descriptors before execve
No need to give whatever we're calling access to what we use
2018-10-17 09:31:46 +00:00
iDunk5400 1e8a9d7dff ANSI colors in Windows 10 (v0.13) 2018-10-16 22:39:21 +02:00
moneromooo-monero bd48280290 util: close keys file lock on exec 2018-10-16 17:21:08 +00:00
Riccardo Spagni 5638b07d9f Merge pull request #4603
8e7baeb3 daemon: fix reading past stack on exit (moneromooo-monero)
2018-10-16 18:22:55 +02:00
Riccardo Spagni d661169c03 Merge pull request #4624
7ae3ebc7 wallet_rpc_server: fix change_wallet_password RPC (moneromooo-monero)
2018-10-16 18:22:35 +02:00
moneromooo-monero 7ae3ebc7a8 wallet_rpc_server: fix change_wallet_password RPC 2018-10-16 15:18:24 +00:00
Riccardo Spagni ccc7e3afae Merge pull request #4622
32ba6f3a wallet2_api: fix generating new wallet in the GUI (moneromooo-monero)
2018-10-16 17:14:09 +02:00
moneromooo-monero 32ba6f3adb wallet2_api: fix generating new wallet in the GUI
It was creating a new wallet without a password first (this should
be fixed), then not changing the password correctly
2018-10-16 14:47:22 +00:00
moneromooo-monero 8e7baeb394 daemon: fix reading past stack on exit 2018-10-15 22:14:17 +00:00
Riccardo Spagni e9fde8aa44 Merge pull request #4598
dae5fcaa update the version in readme (Riccardo Spagni)
5881bec7 bump version to 0.13.0.3 (Riccardo Spagni)
2018-10-15 17:09:08 +02:00
Riccardo Spagni dae5fcaabc update the version in readme 2018-10-15 16:38:39 +02:00
Riccardo Spagni 5881bec7d6 bump version to 0.13.0.3 2018-10-15 16:23:35 +02:00
Riccardo Spagni b66c523046 Merge pull request #4596
e3e1f836 tx_pool: store hex string instead of raw binary to tx_blob of get_transaction_pool RPC (stoffu)
2018-10-15 13:56:18 +02:00
Riccardo Spagni 5f4e1fcc90 Merge pull request #4584
26e0cecb Dockerfile: init and update submodules (Tyler Baker)
2018-10-15 13:56:05 +02:00
Riccardo Spagni 5f1e62115c Merge pull request #4590
82037f23 build: use ARCH 'native' by default, allow to configure and override it (xiphon)
2018-10-15 13:51:08 +02:00
Riccardo Spagni 6834ce6de2 Merge pull request #4574
a04d68f6 SOFTWARE is the default wallet device (m2049r)
2018-10-15 13:50:21 +02:00
Riccardo Spagni 8beb3cd2a1 Merge pull request #4569
e25d21a7 simplewallet: mark default-ring-size setting as obsolete (moneromooo-monero)
2018-10-15 13:49:58 +02:00
Riccardo Spagni dc24639e64 Merge pull request #4579
d7f3805d Revert "p2p: connect via the bound ip, if any" (moneromooo-monero)
2018-10-15 13:49:32 +02:00
Riccardo Spagni 92f42b1e81 Merge pull request #4570
3b04e2e3 daemon: do not run complex code in a signal handler (moneromooo-monero)
2018-10-15 13:49:05 +02:00
Riccardo Spagni 29d7ef0fe0 Merge pull request #4568
2509717b simplewallet: fix view key parsing in --generate-from-view-key (moneromooo-monero)
2018-10-15 13:48:21 +02:00
Riccardo Spagni a9504f7001 Merge pull request #4587
067e232b password: fix secure input with echo on windows (moneromooo-monero)
2018-10-15 13:47:54 +02:00
Riccardo Spagni 3c36a6a227 Merge pull request #4588
b215ea9f password: fix backspace outputting ^? on linux on echoing secure input (moneromooo-monero)
2018-10-15 13:47:27 +02:00
stoffu e3e1f83694 tx_pool: store hex string instead of raw binary to tx_blob of get_transaction_pool RPC
Inspired by https://github.com/masari-project/masari/issues/93
2018-10-15 20:09:32 +09:00
xiphon 82037f2365 build: use ARCH 'native' by default, allow to configure and override it 2018-10-14 23:24:54 +03:00
Tyler Baker 26e0cecb95 Dockerfile: init and update submodules
The Docker image is failing to build, as the submodules are not being
explicitly initialized and updated.

Fixes: https://github.com/monero-project/monero/issues/4582

Signed-off-by: Tyler Baker <tyler@foundries.io>
2018-10-14 07:59:18 -07:00
moneromooo-monero b215ea9f56 password: fix backspace outputting ^? on linux on echoing secure input 2018-10-14 10:39:40 +00:00
moneromooo-monero 067e232b19 password: fix secure input with echo on windows
Thanks to iDunk for the testing back and forth
2018-10-14 10:38:11 +00:00
moneromooo-monero d7f3805d2e Revert "p2p: connect via the bound ip, if any"
This reverts commit 909398efc7.

It looks like it's causing trouble with tor on some setups
2018-10-13 10:20:15 +00:00
m2049r a04d68f698 SOFTWARE is the default wallet device 2018-10-12 23:15:02 +02:00
moneromooo-monero 3b04e2e3d4 daemon: do not run complex code in a signal handler
instead, delegate the work to a one off thread
and notify it from the signal handler
2018-10-12 19:17:55 +00:00
moneromooo-monero e25d21a788 simplewallet: mark default-ring-size setting as obsolete 2018-10-12 13:01:00 +00:00
moneromooo-monero 2509717b11 simplewallet: fix view key parsing in --generate-from-view-key 2018-10-12 12:55:57 +00:00
28 changed files with 201 additions and 82 deletions
+1 -1
View File
@@ -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
View File
@@ -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")
+1
View File
@@ -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 ; \
+3 -3
View File
@@ -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:
+2
View File
@@ -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/")
+4 -1
View File
@@ -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)
+35
View File
@@ -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)
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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
+3
View File
@@ -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
View File
@@ -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
}
}
+2
View File
@@ -238,4 +238,6 @@ namespace tools
#ifdef _WIN32
std::string input_line_win();
#endif
void closefrom(int fd);
}
+2 -2
View File
@@ -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;
}
+6 -1
View File
@@ -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
View File
@@ -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
{
+3 -3
View File
@@ -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;
+3 -3
View File
@@ -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();
+3 -3
View File
@@ -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.");
+10 -6
View File
@@ -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;
+19 -19
View File
@@ -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
View File
@@ -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
+4 -4
View File
@@ -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;
+2 -2
View File
@@ -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
View File
@@ -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;
}
+1 -2
View File
@@ -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)
+5 -5
View File
@@ -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));