Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache doxygen graphviz git curl autoconf libtool gperf nettle-dev libevent-dev debhelper python3-all python3-pip python3-pybind11 python3-pytest
sudo apt install -y build-essential cmake pkg-config libssl-dev libzmq3-dev libunbound-dev libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libexpat1-dev libpgm-dev qttools5-dev-tools libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler libudev-dev libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev libboost-locale-dev libboost-program-options-dev libboost-regex-dev libboost-serialization-dev libboost-system-dev libboost-thread-dev python3 ccache doxygen graphviz git curl autoconf libtool gperf nettle-dev libevent-dev debhelper python3-all python3-pip python3-pybind11 python3-pytest python3-pytest-rerunfailures
pip3 install pybind11-stubgen pytest --break-system-packages

- name: Install expat
Expand Down Expand Up @@ -85,6 +85,8 @@ jobs:
docker compose -f tests/docker-compose.yml up -d node_1 node_2 xmr_wallet_1 xmr_wallet_2

- name: Run tests
env:
REGTEST: "true"
run: |
pytest

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.linux
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN apt-get update && apt-get install -y \
libboost-chrono-dev libboost-date-time-dev libboost-filesystem-dev \
libboost-locale-dev libboost-program-options-dev libboost-regex-dev \
libboost-serialization-dev libboost-system-dev libboost-thread-dev \
python3 python3-pip python3-all python3-pybind11 python3-pytest \
python3 python3-pip python3-all python3-pybind11 python3-pytest python3-pytest-rerunfailures \
ccache doxygen graphviz git curl autoconf libtool gperf nettle-dev libevent-dev \
debhelper bison flex wget \
&& rm -rf /var/lib/apt/lists/*
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ For example: `export LD_PRELOAD=/path/to/libjemalloc.a` then run your app.
```bash
# System-wide installation Ubuntu/Debian

sudo apt install -y python3-pytest
sudo apt install -y python3-pytest python3-pytest-rerunfailures
```
```bash
# System-wide installation Fedora/RedHat

sudo dnf install -y python3-pytest
sudo dnf install -y python3-pytest python3-pytest-rerunfailures
```
2. Clone the project repository:
```bash
Expand Down
22 changes: 13 additions & 9 deletions src/cpp/daemon/py_monero_daemon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ std::string PyMoneroDaemonRpc::get_block_hash(uint64_t height) {
}

std::shared_ptr<PyMoneroBlockTemplate> PyMoneroDaemonRpc::get_block_template(std::string& wallet_address, int reserve_size) {
auto params = std::make_shared<PyMoneroGetBlockParams>(wallet_address, reserve_size);
auto params = std::make_shared<PyMoneroGetBlockTemplateParams>(wallet_address, reserve_size);
PyMoneroJsonRequest request("get_block_template", params);
std::shared_ptr<PyMoneroJsonResponse> response = m_rpc->send_json_request(request);

Expand All @@ -197,7 +197,7 @@ std::shared_ptr<PyMoneroBlockTemplate> PyMoneroDaemonRpc::get_block_template(std
}

std::shared_ptr<PyMoneroBlockTemplate> PyMoneroDaemonRpc::get_block_template(std::string& wallet_address) {
auto params = std::make_shared<PyMoneroGetBlockParams>(wallet_address);
auto params = std::make_shared<PyMoneroGetBlockTemplateParams>(wallet_address);
PyMoneroJsonRequest request("get_block_template", params);
std::shared_ptr<PyMoneroJsonResponse> response = m_rpc->send_json_request(request);

Expand All @@ -224,7 +224,7 @@ std::shared_ptr<monero::monero_block_header> PyMoneroDaemonRpc::get_last_block_h
std::shared_ptr<monero::monero_block_header> PyMoneroDaemonRpc::get_block_header_by_hash(const std::string& hash) {
std::shared_ptr<PyMoneroGetBlockParams> params = std::make_shared<PyMoneroGetBlockParams>(hash);

PyMoneroJsonRequest request("/get_block_header_by_hash", params);
PyMoneroJsonRequest request("get_block_header_by_hash", params);

auto response = m_rpc->send_json_request(request);
if (response->m_result == boost::none) throw std::runtime_error("Invalid Monero JSONRPC response");
Expand All @@ -238,7 +238,7 @@ std::shared_ptr<monero::monero_block_header> PyMoneroDaemonRpc::get_block_header
std::shared_ptr<monero::monero_block_header> PyMoneroDaemonRpc::get_block_header_by_height(uint64_t height) {
std::shared_ptr<PyMoneroGetBlockParams> params = std::make_shared<PyMoneroGetBlockParams>(height);

PyMoneroJsonRequest request("/get_block_header_by_height", params);
PyMoneroJsonRequest request("get_block_header_by_height", params);

auto response = m_rpc->send_json_request(request);
if (response->m_result == boost::none) throw std::runtime_error("Invalid Monero JSONRPC response");
Expand All @@ -250,7 +250,7 @@ std::shared_ptr<monero::monero_block_header> PyMoneroDaemonRpc::get_block_header
}

std::vector<std::shared_ptr<monero::monero_block_header>> PyMoneroDaemonRpc::get_block_headers_by_range(uint64_t start_height, uint64_t end_height) {
auto params = std::make_shared<PyMoneroGetBlockRangeParams>();
auto params = std::make_shared<PyMoneroGetBlockRangeParams>(start_height, end_height);
PyMoneroJsonRequest request("get_block_headers_range", params);

auto response = m_rpc->send_json_request(request);
Expand All @@ -265,7 +265,7 @@ std::vector<std::shared_ptr<monero::monero_block_header>> PyMoneroDaemonRpc::get
std::shared_ptr<monero::monero_block> PyMoneroDaemonRpc::get_block_by_hash(const std::string& hash) {
std::shared_ptr<PyMoneroGetBlockParams> params = std::make_shared<PyMoneroGetBlockParams>(hash);

PyMoneroJsonRequest request("/get_block", params);
PyMoneroJsonRequest request("get_block", params);

auto response = m_rpc->send_json_request(request);
if (response->m_result == boost::none) throw std::runtime_error("Invalid Monero JSONRPC response");
Expand All @@ -282,7 +282,7 @@ std::vector<std::shared_ptr<monero::monero_block>> PyMoneroDaemonRpc::get_blocks
std::shared_ptr<monero::monero_block> PyMoneroDaemonRpc::get_block_by_height(uint64_t height) {
std::shared_ptr<PyMoneroGetBlockParams> params = std::make_shared<PyMoneroGetBlockParams>(height);

PyMoneroJsonRequest request("/get_block", params);
PyMoneroJsonRequest request("get_block", params);

auto response = m_rpc->send_json_request(request);
if (response->m_result == boost::none) throw std::runtime_error("Invalid Monero JSONRPC response");
Expand Down Expand Up @@ -472,7 +472,7 @@ std::shared_ptr<PyMoneroDaemonInfo> PyMoneroDaemonRpc::get_info() {
}

std::shared_ptr<PyMoneroDaemonSyncInfo> PyMoneroDaemonRpc::get_sync_info() {
PyMoneroJsonRequest request("get_sync_info");
PyMoneroJsonRequest request("sync_info");
std::shared_ptr<PyMoneroJsonResponse> response = m_rpc->send_json_request(request);

if (response->m_result == boost::none) throw std::runtime_error("Invalid Monero JSONRPC response");
Expand All @@ -498,7 +498,7 @@ std::shared_ptr<PyMoneroHardForkInfo> PyMoneroDaemonRpc::get_hard_fork_info() {
std::vector<std::shared_ptr<PyMoneroAltChain>> PyMoneroDaemonRpc::get_alt_chains() {
std::vector<std::shared_ptr<PyMoneroAltChain>> result;

PyMoneroJsonRequest request("/get_alternate_chains");
PyMoneroJsonRequest request("get_alternate_chains");
std::shared_ptr<PyMoneroJsonResponse> response = m_rpc->send_json_request(request);

if (response->m_result == boost::none) throw std::runtime_error("Invalid Monero JSONRPC response");
Expand Down Expand Up @@ -537,6 +537,8 @@ int PyMoneroDaemonRpc::get_download_limit() {
}

int PyMoneroDaemonRpc::set_download_limit(int limit) {
if (limit == -1) return reset_download_limit();
if (limit <= 0) throw std::runtime_error("Download limit must be an integer greater than 0");
auto res = set_bandwidth_limits(0, limit);
if (res->m_down != boost::none) return res->m_down.get();
throw std::runtime_error("Could not set download limit");
Expand All @@ -555,6 +557,8 @@ int PyMoneroDaemonRpc::get_upload_limit() {
}

int PyMoneroDaemonRpc::set_upload_limit(int limit) {
if (limit == -1) return reset_upload_limit();
if (limit <= 0) throw std::runtime_error("Upload limit must be an integer greater than 0");
auto res = set_bandwidth_limits(limit, 0);
if (res->m_up != boost::none) return res->m_up.get();
throw std::runtime_error("Could not set download limit");
Expand Down
Loading