Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| beee286c7b | |||
| 44484acf2d | |||
| 2b188151d4 | |||
| cf2b151116 | |||
| 9a2157d71a | |||
| 57f15994a5 | |||
| ada6a8a2de | |||
| 6f9310bde8 | |||
| 1ef92074ad | |||
| 8c84d48caa | |||
| 3435038a4d | |||
| 1e7f783f69 | |||
| 4cb6b265ee | |||
| 0e7722ff40 | |||
| 2f88c14f53 | |||
| 45c98e948b | |||
| 954cc459d2 | |||
| ed6f2e8323 | |||
| b944949bb0 | |||
| 6a66ecc079 | |||
| b352330a3f | |||
| 089df0a7a4 | |||
| 2b38973b5c | |||
| bc8d325216 | |||
| 29b34ed156 | |||
| eabe3bf20c | |||
| 032fd3543d | |||
| 5db8df7bb6 | |||
| 38b9226f44 | |||
| b4c90d5645 | |||
| a2b90426bd | |||
| 4d05955d53 | |||
| 2c51c4d186 | |||
| 583a7b5c74 | |||
| a1cd4db4e6 | |||
| a6f0abb7c3 | |||
| 520756c3c5 | |||
| 8262da8137 | |||
| 9effa55311 | |||
| 240054a7f8 | |||
| 3bdda60f3e | |||
| e4dbea976e |
@@ -0,0 +1 @@
|
||||
*
|
||||
+25
-30
@@ -1,40 +1,35 @@
|
||||
FROM debian:testing
|
||||
MAINTAINER eiabea <developer@eiabea.com>
|
||||
FROM ubuntu:16.04
|
||||
|
||||
# Install clone dependencies
|
||||
RUN set -e && \
|
||||
apt-get update -q && \
|
||||
apt-get install -q -y --no-install-recommends ca-certificates git && \
|
||||
git clone https://github.com/monero-project/monero.git src && \
|
||||
apt-get purge -y git && \
|
||||
apt-get clean -q -y && \
|
||||
apt-get autoclean -q -y && \
|
||||
apt-get autoremove -q -y
|
||||
ENV SRC_DIR /usr/local/src/monero
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
# Install make dependencies
|
||||
RUN set -e && \
|
||||
apt-get update -q && \
|
||||
apt-get install -q -y --no-install-recommends build-essential ca-certificates g++ gcc cmake \
|
||||
pkg-config libunbound2 libevent-2.0-5 libgtest-dev libboost-all-dev libdb5.3++-dev libdb5.3-dev libssl1.0-dev && \
|
||||
make -j 4 && \
|
||||
apt-get purge -y g++ gcc cmake pkg-config && \
|
||||
apt-get clean -q -y && \
|
||||
apt-get autoclean -q -y && \
|
||||
apt-get autoremove -q -y && \
|
||||
mkdir /monero && \
|
||||
mv /src/build/release/bin/* /monero && \
|
||||
rm -rf /src
|
||||
|
||||
WORKDIR /monero
|
||||
RUN set -x \
|
||||
&& buildDeps=' \
|
||||
ca-certificates \
|
||||
cmake \
|
||||
g++ \
|
||||
git \
|
||||
libboost1.58-all-dev \
|
||||
libssl-dev \
|
||||
make \
|
||||
pkg-config \
|
||||
' \
|
||||
&& apt-get -qq update \
|
||||
&& apt-get -qq --no-install-recommends install $buildDeps \
|
||||
\
|
||||
&& git clone https://github.com/monero-project/monero.git $SRC_DIR \
|
||||
&& cd $SRC_DIR \
|
||||
&& make -j$(nproc) release-static \
|
||||
&& cp build/release/bin/* /usr/local/bin/ \
|
||||
\
|
||||
&& rm -r $SRC_DIR \
|
||||
&& apt-get -qq --auto-remove purge $buildDeps
|
||||
|
||||
# Contains the blockchain
|
||||
VOLUME /root/.bitmonero
|
||||
|
||||
# Generate your wallet via accessing the container and run:
|
||||
# cd /wallet
|
||||
# /./bitmonero/monero-wallet-cli
|
||||
# monero-wallet-cli
|
||||
VOLUME /wallet
|
||||
|
||||
ENV LOG_LEVEL 0
|
||||
@@ -46,4 +41,4 @@ ENV RPC_BIND_PORT 18081
|
||||
EXPOSE 18080
|
||||
EXPOSE 18081
|
||||
|
||||
CMD ./monerod --log-level=$LOG_LEVEL --p2p-bind-ip=$P2P_BIND_IP --p2p-bind-port=$P2P_BIND_PORT --rpc-bind-ip=$RPC_BIND_IP --rpc-bind-port=$RPC_BIND_PORT
|
||||
CMD monerod --log-level=$LOG_LEVEL --p2p-bind-ip=$P2P_BIND_IP --p2p-bind-port=$P2P_BIND_PORT --rpc-bind-ip=$RPC_BIND_IP --rpc-bind-port=$RPC_BIND_PORT
|
||||
|
||||
@@ -78,7 +78,7 @@ release-static-linux-armv7:
|
||||
|
||||
release-static-android:
|
||||
mkdir -p build/release
|
||||
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D INSTALL_VENDORED_LIBUNBOUND=ON -D BUILD_TAG="android"../.. && $(MAKE)
|
||||
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D INSTALL_VENDORED_LIBUNBOUND=ON -D BUILD_TAG="android" ../.. && $(MAKE)
|
||||
|
||||
release-static-linux-armv8:
|
||||
mkdir -p build/release
|
||||
|
||||
@@ -138,7 +138,6 @@ library archives (`.a`).
|
||||
| CMake | 3.0.0 | NO | `cmake` | `cmake` | NO | |
|
||||
| pkg-config | any | NO | `pkg-config` | `base-devel` | NO | |
|
||||
| Boost | 1.58 | NO | `libboost-all-dev` | `boost` | NO | C++ libraries |
|
||||
| libevent | 2.0 | NO | `libevent-dev` | `libevent` | NO | Network IO |
|
||||
| OpenSSL | basically any | NO | `libssl-dev` | `openssl` | NO | sha256 sum |
|
||||
| libunbound | 1.4.16 | YES | `libunbound-dev` | `unbound` | NO | DNS resolver |
|
||||
| libminiupnpc | 2.0 | YES | `libminiupnpc-dev` | `miniupnpc` | YES | NAT punching |
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace epee
|
||||
namespace net_utils
|
||||
{
|
||||
template<class t_request, class t_response, class t_transport>
|
||||
bool invoke_http_json(const boost::string_ref uri, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(5), const boost::string_ref method = "GET")
|
||||
bool invoke_http_json(const boost::string_ref uri, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref method = "GET")
|
||||
{
|
||||
std::string req_param;
|
||||
if(!serialization::store_t_to_json(out_struct, req_param))
|
||||
@@ -69,7 +69,7 @@ namespace epee
|
||||
|
||||
|
||||
template<class t_request, class t_response, class t_transport>
|
||||
bool invoke_http_bin(const boost::string_ref uri, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(5), const boost::string_ref method = "GET")
|
||||
bool invoke_http_bin(const boost::string_ref uri, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref method = "GET")
|
||||
{
|
||||
std::string req_param;
|
||||
if(!serialization::store_t_to_binary(out_struct, req_param))
|
||||
@@ -98,7 +98,7 @@ namespace epee
|
||||
}
|
||||
|
||||
template<class t_request, class t_response, class t_transport>
|
||||
bool invoke_http_json_rpc(const boost::string_ref uri, std::string method_name, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(5), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
|
||||
bool invoke_http_json_rpc(const boost::string_ref uri, std::string method_name, const t_request& out_struct, t_response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
|
||||
{
|
||||
epee::json_rpc::request<t_request> req_t = AUTO_VAL_INIT(req_t);
|
||||
req_t.jsonrpc = "2.0";
|
||||
@@ -120,7 +120,7 @@ namespace epee
|
||||
}
|
||||
|
||||
template<class t_command, class t_transport>
|
||||
bool invoke_http_json_rpc(const boost::string_ref uri, typename t_command::request& out_struct, typename t_command::response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(5), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
|
||||
bool invoke_http_json_rpc(const boost::string_ref uri, typename t_command::request& out_struct, typename t_command::response& result_struct, t_transport& transport, std::chrono::milliseconds timeout = std::chrono::seconds(15), const boost::string_ref http_method = "GET", const std::string& req_id = "0")
|
||||
{
|
||||
return invoke_http_json_rpc(uri, t_command::methodname(), out_struct, result_struct, transport, timeout, http_method, req_id);
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
export LD_LIBRARY_PATH=${SNAP_LIBRARY_PATH}:${SNAP}/usr/lib/x86_64-linux-gnu
|
||||
export HOME=${SNAP_DATA}
|
||||
cd ${SNAP_DATA}
|
||||
|
||||
ARGS=
|
||||
if [ -e "${SNAP_DATA}/etc/monerod.conf" ]; then
|
||||
ARGS="--config-file ${SNAP_DATA}/etc/monerod.conf"
|
||||
fi
|
||||
|
||||
exec ${SNAP}/bin/monerod --detach $ARGS
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
exec tail -c +0 -F ${SNAP_DATA}/.bitmonero/bitmonero.log
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -d "$SNAP_USER_DATA/etc" ]; then
|
||||
mkdir $SNAP_USER_DATA/etc/
|
||||
cp -R $SNAP/etc/monerod.conf $SNAP_USER_DATA/etc/monerod.conf
|
||||
fi
|
||||
|
||||
exec "$SNAP/bin/monerod" "$@"
|
||||
@@ -0,0 +1,9 @@
|
||||
# Configuration for monerod
|
||||
# Syntax: any command line option may be specified as 'clioptionname=value'.
|
||||
# See 'monerod --help' for all available options.
|
||||
|
||||
# Overrided by snap:
|
||||
# data-dir=/var/lib/monero
|
||||
# log-file=/var/log/monero/monero.log
|
||||
|
||||
log-level=0
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
@@ -1,5 +1,5 @@
|
||||
name: monero
|
||||
version: 0.10.1 # Current stable version
|
||||
version: 0.10.2-1
|
||||
summary: "Monero: the secure, private, untraceable cryptocurrency https://getmonero.org"
|
||||
description: |
|
||||
Monero is a private, secure, untraceable, decentralised digital currency.
|
||||
@@ -12,20 +12,20 @@ apps:
|
||||
monerod:
|
||||
daemon: forking
|
||||
command: |
|
||||
monerod --detach --data-dir ${SNAP_DATA}
|
||||
monerod-wrapper --detach --data-dir ${SNAP_COMMON} --config-file ${SNAP_USER_DATA}/etc/monerod.conf
|
||||
plugs:
|
||||
- network
|
||||
- network-bind
|
||||
monero-wallet-rpc:
|
||||
command: |
|
||||
monero-wallet-rpc --log-file ${SNAP_USER_DATA}
|
||||
monero-wallet-rpc --log-file ${SNAP_USER_DATA}
|
||||
plugs:
|
||||
- home
|
||||
- network
|
||||
- network-bind
|
||||
monero-wallet-cli:
|
||||
command: |
|
||||
monero-wallet-cli --log-file ${SNAP_USER_DATA}
|
||||
monero-wallet-cli --log-file ${SNAP_USER_DATA}
|
||||
plugs:
|
||||
- home
|
||||
- network
|
||||
@@ -63,3 +63,13 @@ parts:
|
||||
- usr/lib/
|
||||
- -usr/lib/gcc
|
||||
- -usr/share
|
||||
|
||||
dist-files:
|
||||
plugin: dump
|
||||
source: .
|
||||
organize:
|
||||
contrib/snap/monerod.conf: etc/monerod.conf
|
||||
contrib/snap/monerod-wrapper: bin/monerod-wrapper
|
||||
prime:
|
||||
- etc
|
||||
- bin
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
export LD_LIBRARY_PATH=${SNAP_LIBRARY_PATH}:${SNAP}/usr/lib/x86_64-linux-gnu
|
||||
export HOME=${SNAP_USER_DATA}
|
||||
cd ${SNAP_USER_DATA}
|
||||
|
||||
exec ${SNAP}/usr/bin/rlwrap ${SNAP}/bin/monero-wallet-cli "$@"
|
||||
@@ -119,6 +119,7 @@ monero_add_executable(cn_deserialize
|
||||
target_link_libraries(cn_deserialize
|
||||
LINK_PRIVATE
|
||||
cryptonote_core
|
||||
blockchain_db
|
||||
p2p
|
||||
epee
|
||||
${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
@@ -587,6 +587,18 @@ std::string get_nix_version_display_string()
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool sha256sum(const uint8_t *data, size_t len, crypto::hash &hash)
|
||||
{
|
||||
SHA256_CTX ctx;
|
||||
if (!SHA256_Init(&ctx))
|
||||
return false;
|
||||
if (!SHA256_Update(&ctx, data, len))
|
||||
return false;
|
||||
if (!SHA256_Final((unsigned char*)hash.data, &ctx))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool sha256sum(const std::string &filename, crypto::hash &hash)
|
||||
{
|
||||
if (!epee::file_io_utils::is_file_exist(filename))
|
||||
|
||||
@@ -185,5 +185,6 @@ namespace tools
|
||||
bool is_local_address(const std::string &address);
|
||||
int vercmp(const char *v0, const char *v1); // returns < 0, 0, > 0, similar to strcmp, but more human friendly than lexical - does not attempt to validate
|
||||
|
||||
bool sha256sum(const uint8_t *data, size_t len, crypto::hash &hash);
|
||||
bool sha256sum(const std::string &filename, crypto::hash &hash);
|
||||
}
|
||||
|
||||
@@ -3995,10 +3995,37 @@ void Blockchain::cancel()
|
||||
}
|
||||
|
||||
#if defined(PER_BLOCK_CHECKPOINT)
|
||||
static const char expected_block_hashes_hash[] = "23d8a8c73de7b2383c72a016d9a6034e69d62dd48077d1c414e064ceab6daa94";
|
||||
void Blockchain::load_compiled_in_block_hashes()
|
||||
{
|
||||
if (m_fast_sync && get_blocks_dat_start(m_testnet) != nullptr)
|
||||
{
|
||||
MINFO("Loading precomputed blocks (" << get_blocks_dat_size(m_testnet) << " bytes)");
|
||||
|
||||
if (!m_testnet)
|
||||
{
|
||||
// first check hash
|
||||
crypto::hash hash;
|
||||
if (!tools::sha256sum(get_blocks_dat_start(m_testnet), get_blocks_dat_size(m_testnet), hash))
|
||||
{
|
||||
MERROR("Failed to hash precomputed blocks data");
|
||||
return;
|
||||
}
|
||||
MINFO("precomputed blocks hash: " << hash << ", expected " << expected_block_hashes_hash);
|
||||
cryptonote::blobdata expected_hash_data;
|
||||
if (!epee::string_tools::parse_hexstr_to_binbuff(std::string(expected_block_hashes_hash), expected_hash_data) || expected_hash_data.size() != sizeof(crypto::hash))
|
||||
{
|
||||
MERROR("Failed to parse expected block hashes hash");
|
||||
return;
|
||||
}
|
||||
const crypto::hash expected_hash = *reinterpret_cast<const crypto::hash*>(expected_hash_data.data());
|
||||
if (hash != expected_hash)
|
||||
{
|
||||
MERROR("Block hash data does not match expected hash");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (get_blocks_dat_size(m_testnet) > 4)
|
||||
{
|
||||
const unsigned char *p = get_blocks_dat_start(m_testnet);
|
||||
@@ -4006,7 +4033,6 @@ void Blockchain::load_compiled_in_block_hashes()
|
||||
const size_t size_needed = 4 + nblocks * sizeof(crypto::hash);
|
||||
if(nblocks > 0 && nblocks > m_db->height() && get_blocks_dat_size(m_testnet) >= size_needed)
|
||||
{
|
||||
MINFO("Loading precomputed blocks: " << nblocks);
|
||||
p += sizeof(uint32_t);
|
||||
for (uint32_t i = 0; i < nblocks; i++)
|
||||
{
|
||||
@@ -4015,6 +4041,7 @@ void Blockchain::load_compiled_in_block_hashes()
|
||||
p += sizeof(hash.data);
|
||||
m_blocks_hash_check.push_back(hash);
|
||||
}
|
||||
MINFO(nblocks << " block hashes loaded");
|
||||
|
||||
// FIXME: clear tx_pool because the process might have been
|
||||
// terminated and caused it to store txs kept by blocks.
|
||||
|
||||
@@ -60,6 +60,8 @@ DISABLE_VS_WARNINGS(4355)
|
||||
|
||||
#define MERROR_VER(x) MCERROR("verify", x)
|
||||
|
||||
#define BAD_SEMANTICS_TXES_MAX_SIZE 100
|
||||
|
||||
namespace cryptonote
|
||||
{
|
||||
|
||||
@@ -496,11 +498,14 @@ namespace cryptonote
|
||||
}
|
||||
//std::cout << "!"<< tx.vin.size() << std::endl;
|
||||
|
||||
if (bad_semantics_txes.find(tx_hash) != bad_semantics_txes.end())
|
||||
for (int idx = 0; idx < 2; ++idx)
|
||||
{
|
||||
LOG_PRINT_L1("Transaction already seen with bad semantics, rejected");
|
||||
tvc.m_verifivation_failed = true;
|
||||
return false;
|
||||
if (bad_semantics_txes[idx].find(tx_hash) != bad_semantics_txes[idx].end())
|
||||
{
|
||||
LOG_PRINT_L1("Transaction already seen with bad semantics, rejected");
|
||||
tvc.m_verifivation_failed = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t version = m_blockchain_storage.get_current_hard_fork_version();
|
||||
@@ -551,8 +556,13 @@ namespace cryptonote
|
||||
if(!check_tx_semantic(tx, keeped_by_block))
|
||||
{
|
||||
LOG_PRINT_L1("WRONG TRANSACTION BLOB, Failed to check tx " << tx_hash << " semantic, rejected");
|
||||
bad_semantics_txes.insert(tx_hash);
|
||||
tvc.m_verifivation_failed = true;
|
||||
bad_semantics_txes[0].insert(tx_hash);
|
||||
if (bad_semantics_txes[0].size() >= BAD_SEMANTICS_TXES_MAX_SIZE)
|
||||
{
|
||||
std::swap(bad_semantics_txes[0], bad_semantics_txes[1]);
|
||||
bad_semantics_txes[0].clear();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -818,7 +818,6 @@ namespace cryptonote
|
||||
epee::math_helper::once_a_time_seconds<60*2, false> m_txpool_auto_relayer; //!< interval for checking re-relaying txpool transactions
|
||||
epee::math_helper::once_a_time_seconds<60*60*12, true> m_check_updates_interval; //!< interval for checking for new versions
|
||||
|
||||
friend class tx_validate_inputs;
|
||||
std::atomic<bool> m_starter_message_showed; //!< has the "daemon will sync now" message been shown?
|
||||
|
||||
uint64_t m_target_blockchain_height; //!< blockchain height target
|
||||
@@ -833,13 +832,11 @@ namespace cryptonote
|
||||
|
||||
std::atomic_flag m_checkpoints_updating; //!< set if checkpoints are currently updating to avoid multiple threads attempting to update at once
|
||||
|
||||
boost::interprocess::file_lock db_lock; //!< a lock object for a file lock in the db directory
|
||||
|
||||
size_t block_sync_size;
|
||||
|
||||
time_t start_time;
|
||||
|
||||
std::unordered_set<crypto::hash> bad_semantics_txes;
|
||||
std::unordered_set<crypto::hash> bad_semantics_txes[2];
|
||||
|
||||
enum {
|
||||
UPDATES_DISABLED,
|
||||
|
||||
@@ -266,6 +266,9 @@ namespace cryptonote
|
||||
return true;
|
||||
|
||||
uint64_t target = m_core.get_target_blockchain_height();
|
||||
if (target == 0)
|
||||
target = m_core.get_current_blockchain_height();
|
||||
|
||||
if(m_core.have_block(hshd.top_id))
|
||||
{
|
||||
context.m_state = cryptonote_connection_context::state_normal;
|
||||
@@ -280,7 +283,6 @@ namespace cryptonote
|
||||
I prefer pushing target height to the core at the same time it is pushed to the user.
|
||||
Nz. */
|
||||
m_core.set_target_blockchain_height(static_cast<int64_t>(hshd.current_height));
|
||||
|
||||
int64_t diff = static_cast<int64_t>(hshd.current_height) - static_cast<int64_t>(m_core.get_current_blockchain_height());
|
||||
int64_t max_block_height = max(static_cast<int64_t>(hshd.current_height),static_cast<int64_t>(m_core.get_current_blockchain_height()));
|
||||
int64_t last_block_v1 = 1009826;
|
||||
|
||||
@@ -51,6 +51,13 @@ bool t_command_parser_executor::print_peer_list(const std::vector<std::string>&
|
||||
return m_executor.print_peer_list();
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::print_peer_list_stats(const std::vector<std::string>& args)
|
||||
{
|
||||
if (!args.empty()) return false;
|
||||
|
||||
return m_executor.print_peer_list_stats();
|
||||
}
|
||||
|
||||
bool t_command_parser_executor::save_blockchain(const std::vector<std::string>& args)
|
||||
{
|
||||
if (!args.empty()) return false;
|
||||
|
||||
@@ -59,6 +59,8 @@ public:
|
||||
|
||||
bool print_peer_list(const std::vector<std::string>& args);
|
||||
|
||||
bool print_peer_list_stats(const std::vector<std::string>& args);
|
||||
|
||||
bool save_blockchain(const std::vector<std::string>& args);
|
||||
|
||||
bool show_hash_rate(const std::vector<std::string>& args);
|
||||
|
||||
@@ -68,6 +68,11 @@ t_command_server::t_command_server(
|
||||
, std::bind(&t_command_parser_executor::print_peer_list, &m_parser, p::_1)
|
||||
, "Print peer list"
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"print_pl_stats"
|
||||
, std::bind(&t_command_parser_executor::print_peer_list_stats, &m_parser, p::_1)
|
||||
, "Print peer list stats"
|
||||
);
|
||||
m_command_lookup.set_handler(
|
||||
"print_cn"
|
||||
, std::bind(&t_command_parser_executor::print_connections, &m_parser, p::_1)
|
||||
|
||||
+3
-1
@@ -168,7 +168,6 @@ int main(int argc, char const * argv[])
|
||||
// Create data dir if it doesn't exist
|
||||
boost::filesystem::path data_dir = boost::filesystem::absolute(
|
||||
command_line::get_arg(vm, data_dir_arg));
|
||||
tools::create_directories_if_necessary(data_dir.string());
|
||||
|
||||
// FIXME: not sure on windows implementation default, needs further review
|
||||
//bf::path relative_path_base = daemonizer::get_relative_path_base(vm);
|
||||
@@ -216,6 +215,9 @@ int main(int argc, char const * argv[])
|
||||
mlog_set_log(command_line::get_arg(vm, daemon_args::arg_log_level).c_str());
|
||||
}
|
||||
|
||||
// after logs initialized
|
||||
tools::create_directories_if_necessary(data_dir.string());
|
||||
|
||||
// If there are positional options, we're running a daemon command
|
||||
{
|
||||
auto command = command_line::get_arg(vm, daemon_args::arg_command);
|
||||
|
||||
@@ -162,6 +162,34 @@ bool t_rpc_command_executor::print_peer_list() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::print_peer_list_stats() {
|
||||
cryptonote::COMMAND_RPC_GET_PEER_LIST::request req;
|
||||
cryptonote::COMMAND_RPC_GET_PEER_LIST::response res;
|
||||
|
||||
std::string failure_message = "Couldn't retrieve peer list";
|
||||
if (m_is_rpc)
|
||||
{
|
||||
if (!m_rpc_client->rpc_request(req, res, "/get_peer_list", failure_message.c_str()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_rpc_server->on_get_peer_list(req, res) || res.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
tools::fail_msg_writer() << failure_message;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
tools::msg_writer()
|
||||
<< "White list size: " << res.white_list.size() << "/" << P2P_LOCAL_WHITE_PEERLIST_LIMIT << " (" << res.white_list.size() * 100.0 / P2P_LOCAL_WHITE_PEERLIST_LIMIT << "%)" << std::endl
|
||||
<< "Gray list size: " << res.gray_list.size() << "/" << P2P_LOCAL_GRAY_PEERLIST_LIMIT << " (" << res.gray_list.size() * 100.0 / P2P_LOCAL_GRAY_PEERLIST_LIMIT << "%)";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool t_rpc_command_executor::save_blockchain() {
|
||||
cryptonote::COMMAND_RPC_SAVE_BC::request req;
|
||||
cryptonote::COMMAND_RPC_SAVE_BC::response res;
|
||||
|
||||
@@ -72,6 +72,8 @@ public:
|
||||
|
||||
bool print_peer_list();
|
||||
|
||||
bool print_peer_list_stats();
|
||||
|
||||
bool save_blockchain();
|
||||
|
||||
bool show_hash_rate();
|
||||
|
||||
@@ -665,7 +665,7 @@ namespace cryptonote
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
bool core_rpc_server::on_mining_status(const COMMAND_RPC_MINING_STATUS::request& req, COMMAND_RPC_MINING_STATUS::response& res)
|
||||
{
|
||||
CHECK_CORE_READY();
|
||||
CHECK_CORE_BUSY();
|
||||
|
||||
const miner& lMiner = m_core.get_miner();
|
||||
res.active = lMiner.is_mining();
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace cryptonote
|
||||
rpc_args::descriptors::descriptors()
|
||||
: rpc_bind_ip({"rpc-bind-ip", rpc_args::tr("Specify ip to bind rpc server"), "127.0.0.1"})
|
||||
, rpc_login({"rpc-login", rpc_args::tr("Specify username[:password] required for RPC server"), "", true})
|
||||
, confirm_external_bind({"confirm-external-bind", rpc_args::tr("Confirm rcp-bind-ip value is NOT a loopback (local) IP")})
|
||||
, confirm_external_bind({"confirm-external-bind", rpc_args::tr("Confirm rpc-bind-ip value is NOT a loopback (local) IP")})
|
||||
{}
|
||||
|
||||
const char* rpc_args::tr(const char* str) { return i18n_translate(str, "cryptonote::rpc_args"); }
|
||||
|
||||
@@ -629,7 +629,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-mixin <n> - set default mixin (default is 4); 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 [1|2|3] - normal/elevated/priority fee; confirm-missing-payment-id <1|0>"));
|
||||
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-mixin <n> - set default mixin (default is 4); 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 [1|2|3] - normal/elevated/priority fee; confirm-missing-payment-id <1|0>; ask-password <1|0>"));
|
||||
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>"));
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
#define MONERO_VERSION_TAG "@VERSIONTAG@"
|
||||
#define MONERO_VERSION "0.10.2.0"
|
||||
#define MONERO_VERSION "0.10.2.1"
|
||||
#define MONERO_RELEASE_NAME "Wolfram Warptangent"
|
||||
#define MONERO_VERSION_FULL MONERO_VERSION "-" MONERO_VERSION_TAG
|
||||
|
||||
@@ -2298,7 +2298,11 @@ bool wallet2::check_connection(uint32_t *version, uint32_t timeout)
|
||||
req_t.id = epee::serialization::storage_entry(0);
|
||||
req_t.method = "get_version";
|
||||
bool r = net_utils::invoke_http_json("/json_rpc", req_t, resp_t, m_http_client);
|
||||
if (!r || resp_t.result.status != CORE_RPC_STATUS_OK)
|
||||
if(!r) {
|
||||
*version = 0;
|
||||
return false;
|
||||
}
|
||||
if (resp_t.result.status != CORE_RPC_STATUS_OK)
|
||||
*version = 0;
|
||||
else
|
||||
*version = resp_t.result.version;
|
||||
@@ -3453,7 +3457,7 @@ void wallet2::get_outs(std::vector<std::vector<tools::wallet2::get_outs_entry>>
|
||||
req_t.params.amounts.resize(std::distance(req_t.params.amounts.begin(), end));
|
||||
req_t.params.unlocked = true;
|
||||
req_t.params.recent_cutoff = time(NULL) - RECENT_OUTPUT_ZONE;
|
||||
bool r = net_utils::invoke_http_json("/json_rpc", req_t, resp_t, m_http_client);
|
||||
bool r = net_utils::invoke_http_json("/json_rpc", req_t, resp_t, m_http_client, rpc_timeout);
|
||||
m_daemon_rpc_mutex.unlock();
|
||||
THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "transfer_selected");
|
||||
THROW_WALLET_EXCEPTION_IF(resp_t.result.status == CORE_RPC_STATUS_BUSY, error::daemon_busy, "get_output_histogram");
|
||||
@@ -4653,7 +4657,7 @@ std::vector<size_t> wallet2::select_available_outputs_from_histogram(uint64_t co
|
||||
req_t.params.min_count = count;
|
||||
req_t.params.max_count = 0;
|
||||
req_t.params.unlocked = unlocked;
|
||||
bool r = net_utils::invoke_http_json("/json_rpc", req_t, resp_t, m_http_client);
|
||||
bool r = net_utils::invoke_http_json("/json_rpc", req_t, resp_t, m_http_client, rpc_timeout);
|
||||
m_daemon_rpc_mutex.unlock();
|
||||
THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "select_available_outputs_from_histogram");
|
||||
THROW_WALLET_EXCEPTION_IF(resp_t.result.status == CORE_RPC_STATUS_BUSY, error::daemon_busy, "get_output_histogram");
|
||||
@@ -4692,7 +4696,7 @@ uint64_t wallet2::get_num_rct_outputs()
|
||||
req_t.params.amounts.push_back(0);
|
||||
req_t.params.min_count = 0;
|
||||
req_t.params.max_count = 0;
|
||||
bool r = net_utils::invoke_http_json("/json_rpc", req_t, resp_t, m_http_client);
|
||||
bool r = net_utils::invoke_http_json("/json_rpc", req_t, resp_t, m_http_client, rpc_timeout);
|
||||
m_daemon_rpc_mutex.unlock();
|
||||
THROW_WALLET_EXCEPTION_IF(!r, error::no_connection_to_daemon, "get_num_rct_outputs");
|
||||
THROW_WALLET_EXCEPTION_IF(resp_t.result.status == CORE_RPC_STATUS_BUSY, error::daemon_busy, "get_output_histogram");
|
||||
@@ -5424,7 +5428,7 @@ uint64_t wallet2::get_blockchain_height_by_date(uint16_t year, uint8_t month, ui
|
||||
height_mid,
|
||||
height_max
|
||||
};
|
||||
bool r = net_utils::invoke_http_bin("/getblocks_by_height.bin", req, res, m_http_client);
|
||||
bool r = net_utils::invoke_http_bin("/getblocks_by_height.bin", req, res, m_http_client, rpc_timeout);
|
||||
if (!r || res.status != CORE_RPC_STATUS_OK)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
+11
-11
@@ -106,10 +106,21 @@ namespace wallet_args
|
||||
po::options_description desc_all;
|
||||
desc_all.add(desc_general).add(desc_params);
|
||||
po::variables_map vm;
|
||||
std::string log_path;
|
||||
bool r = command_line::handle_error_helper(desc_all, [&]()
|
||||
{
|
||||
po::store(command_line::parse_command_line(argc, argv, desc_general, true), vm);
|
||||
|
||||
if (command_line::has_arg(vm, arg_log_file))
|
||||
log_path = command_line::get_arg(vm, arg_log_file);
|
||||
else
|
||||
log_path = mlog_get_default_log_path("monero-wallet-cli.log");
|
||||
mlog_configure(log_path, log_to_console);
|
||||
if (command_line::has_arg(vm, arg_log_level))
|
||||
{
|
||||
mlog_set_log(command_line::get_arg(vm, arg_log_level).c_str());
|
||||
}
|
||||
|
||||
if (command_line::get_arg(vm, command_line::arg_help))
|
||||
{
|
||||
tools::msg_writer() << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")";
|
||||
@@ -134,17 +145,6 @@ namespace wallet_args
|
||||
if(command_line::has_arg(vm, arg_max_concurrency))
|
||||
tools::set_max_concurrency(command_line::get_arg(vm, arg_max_concurrency));
|
||||
|
||||
std::string log_path;
|
||||
if (!vm["log-file"].defaulted())
|
||||
log_path = command_line::get_arg(vm, arg_log_file);
|
||||
else
|
||||
log_path = mlog_get_default_log_path("monero-wallet-cli.log");
|
||||
mlog_configure(log_path, log_to_console);
|
||||
if (!vm["log-level"].defaulted())
|
||||
{
|
||||
mlog_set_log(command_line::get_arg(vm, arg_log_level).c_str());
|
||||
}
|
||||
|
||||
tools::scoped_message_writer(epee::console_color_white, true) << "Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL << ")";
|
||||
|
||||
if (!vm["log-level"].defaulted())
|
||||
|
||||
@@ -54,6 +54,7 @@ namespace
|
||||
{
|
||||
const command_line::arg_descriptor<std::string, true> arg_rpc_bind_port = {"rpc-bind-port", "Sets bind port for server"};
|
||||
const command_line::arg_descriptor<bool> arg_disable_rpc_login = {"disable-rpc-login", "Disable HTTP authentication for RPC connections served by this process"};
|
||||
const command_line::arg_descriptor<bool> arg_trusted_daemon = {"trusted-daemon", "Enable commands which rely on a trusted daemon", false};
|
||||
|
||||
constexpr const char default_rpc_username[] = "monero";
|
||||
}
|
||||
@@ -66,7 +67,7 @@ namespace tools
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
wallet_rpc_server::wallet_rpc_server(wallet2& w):m_wallet(w), rpc_login_filename(), m_stop(false)
|
||||
wallet_rpc_server::wallet_rpc_server(wallet2& w):m_wallet(w), rpc_login_filename(), m_stop(false), m_trusted_daemon(false)
|
||||
{}
|
||||
//------------------------------------------------------------------------------------------------------------------------------
|
||||
wallet_rpc_server::~wallet_rpc_server()
|
||||
@@ -112,6 +113,15 @@ namespace tools
|
||||
boost::optional<epee::net_utils::http::login> http_login{};
|
||||
std::string bind_port = command_line::get_arg(vm, arg_rpc_bind_port);
|
||||
const bool disable_auth = command_line::get_arg(vm, arg_disable_rpc_login);
|
||||
m_trusted_daemon = command_line::get_arg(vm, arg_trusted_daemon);
|
||||
if (!command_line::has_arg(vm, arg_trusted_daemon))
|
||||
{
|
||||
if (tools::is_local_address(m_wallet.get_daemon_address()))
|
||||
{
|
||||
MINFO(tr("Daemon is local, assuming trusted"));
|
||||
m_trusted_daemon = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (disable_auth)
|
||||
{
|
||||
@@ -381,7 +391,7 @@ namespace tools
|
||||
LOG_PRINT_L1("Requested mixin " << req.mixin << " too low for hard fork 2, using 2");
|
||||
mixin = 2;
|
||||
}
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet.create_transactions_2(dsts, mixin, req.unlock_time, req.priority, extra, req.trusted_daemon);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet.create_transactions_2(dsts, mixin, req.unlock_time, req.priority, extra, m_trusted_daemon);
|
||||
|
||||
// reject proposed transactions if there are more than one. see on_transfer_split below.
|
||||
if (ptx_vector.size() != 1)
|
||||
@@ -451,7 +461,7 @@ namespace tools
|
||||
}
|
||||
std::vector<wallet2::pending_tx> ptx_vector;
|
||||
LOG_PRINT_L2("on_transfer_split calling create_transactions_2");
|
||||
ptx_vector = m_wallet.create_transactions_2(dsts, mixin, req.unlock_time, req.priority, extra, req.trusted_daemon);
|
||||
ptx_vector = m_wallet.create_transactions_2(dsts, mixin, req.unlock_time, req.priority, extra, m_trusted_daemon);
|
||||
LOG_PRINT_L2("on_transfer_split called create_transactions_2");
|
||||
|
||||
LOG_PRINT_L2("on_transfer_split calling commit_txyy");
|
||||
@@ -503,7 +513,7 @@ namespace tools
|
||||
|
||||
try
|
||||
{
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet.create_unmixable_sweep_transactions(req.trusted_daemon);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet.create_unmixable_sweep_transactions(m_trusted_daemon);
|
||||
|
||||
m_wallet.commit_tx(ptx_vector);
|
||||
|
||||
@@ -565,7 +575,7 @@ namespace tools
|
||||
|
||||
try
|
||||
{
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet.create_transactions_all(dsts[0].addr, req.mixin, req.unlock_time, req.priority, extra, req.trusted_daemon);
|
||||
std::vector<wallet2::pending_tx> ptx_vector = m_wallet.create_transactions_all(dsts[0].addr, req.mixin, req.unlock_time, req.priority, extra, m_trusted_daemon);
|
||||
|
||||
m_wallet.commit_tx(ptx_vector);
|
||||
|
||||
@@ -1376,6 +1386,7 @@ int main(int argc, char** argv) {
|
||||
tools::wallet2::init_options(desc_params);
|
||||
command_line::add_arg(desc_params, arg_rpc_bind_port);
|
||||
command_line::add_arg(desc_params, arg_disable_rpc_login);
|
||||
command_line::add_arg(desc_params, arg_trusted_daemon);
|
||||
cryptonote::rpc_args::init_options(desc_params);
|
||||
command_line::add_arg(desc_params, arg_wallet_file);
|
||||
command_line::add_arg(desc_params, arg_from_json);
|
||||
|
||||
@@ -138,5 +138,6 @@ namespace tools
|
||||
wallet2& m_wallet;
|
||||
std::string rpc_login_filename;
|
||||
std::atomic<bool> m_stop;
|
||||
bool m_trusted_daemon;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -119,7 +119,6 @@ namespace wallet_rpc
|
||||
uint64_t unlock_time;
|
||||
std::string payment_id;
|
||||
bool get_tx_key;
|
||||
bool trusted_daemon;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(destinations)
|
||||
@@ -128,7 +127,6 @@ namespace wallet_rpc
|
||||
KV_SERIALIZE(unlock_time)
|
||||
KV_SERIALIZE(payment_id)
|
||||
KV_SERIALIZE(get_tx_key)
|
||||
KV_SERIALIZE(trusted_daemon)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
@@ -158,7 +156,6 @@ namespace wallet_rpc
|
||||
uint64_t unlock_time;
|
||||
std::string payment_id;
|
||||
bool get_tx_keys;
|
||||
bool trusted_daemon;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(destinations)
|
||||
@@ -167,7 +164,6 @@ namespace wallet_rpc
|
||||
KV_SERIALIZE(unlock_time)
|
||||
KV_SERIALIZE(payment_id)
|
||||
KV_SERIALIZE(get_tx_keys)
|
||||
KV_SERIALIZE(trusted_daemon)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
@@ -199,11 +195,9 @@ namespace wallet_rpc
|
||||
struct request
|
||||
{
|
||||
bool get_tx_keys;
|
||||
bool trusted_daemon;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(get_tx_keys)
|
||||
KV_SERIALIZE(trusted_daemon)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
@@ -240,7 +234,6 @@ namespace wallet_rpc
|
||||
uint64_t unlock_time;
|
||||
std::string payment_id;
|
||||
bool get_tx_keys;
|
||||
bool trusted_daemon;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(address)
|
||||
@@ -249,7 +242,6 @@ namespace wallet_rpc
|
||||
KV_SERIALIZE(unlock_time)
|
||||
KV_SERIALIZE(payment_id)
|
||||
KV_SERIALIZE(get_tx_keys)
|
||||
KV_SERIALIZE(trusted_daemon)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user