mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
Add garbage to make it work on a garbage OS
- Don't touch <fmt/std.h> because it touches std::filesystem which makes macOS throw a hissy fit and refuse to compile. - int_to_string is broken on macOS because it uses std::to_chars which makes macos throw a hissy fit like a cranky old female cat seeing a kitten if it sees it. - wallet3 was using std::filesystem and std::visit, both of which make macos throw a hissy fit. (There is a pattern here). Apply the dumb fs::path and var::visit workarounds needed to appease this garbage OS. - use var::get (from oxenc/variant.h) instead of std::get because, oh yeah, we need to support a garbage OS that Apple themselves don't even properly support. Yay!
This commit is contained in:
parent
6b5a05d3f6
commit
0cf55f3945
|
@ -35,7 +35,6 @@
|
|||
#include <cstring>
|
||||
#include <type_traits>
|
||||
#include <variant>
|
||||
#include <fmt/std.h>
|
||||
#include <fmt/color.h>
|
||||
|
||||
#include "common/string_util.h"
|
||||
|
|
|
@ -112,7 +112,7 @@ target_link_libraries(blockchain_stats PRIVATE blockchain_tools_common_libs date
|
|||
|
||||
if (TARGET sodium_vendor OR NOT SODIUM_VERSION VERSION_LESS 1.0.17)
|
||||
oxen_add_executable(sn_key_tool "oxen-sn-keys" sn_key_tool.cpp)
|
||||
target_link_libraries(sn_key_tool PRIVATE sodium oxenmq filesystem)
|
||||
target_link_libraries(sn_key_tool PRIVATE sodium oxenmq filesystem fmt::fmt)
|
||||
else()
|
||||
message(STATUS "Not building oxen-sn-keys tool (requires libsodium >= 1.0.17)")
|
||||
endif()
|
||||
|
|
|
@ -47,7 +47,6 @@
|
|||
#include "blockchain_db/blockchain_db.h"
|
||||
#include "version.h"
|
||||
#include "cryptonote_core/uptime_proof.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
using namespace cryptonote;
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
#include "wallet/ringdb.h"
|
||||
#include "version.h"
|
||||
#include "cryptonote_core/uptime_proof.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
using namespace cryptonote;
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "blockchain_db/blockchain_db.h"
|
||||
#include "cryptonote_core/uptime_proof.h"
|
||||
#include "version.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
using namespace cryptonote;
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "blockchain_objects.h"
|
||||
#include "version.h"
|
||||
#include "cryptonote_core/uptime_proof.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@
|
|||
#include "cryptonote_core/uptime_proof.h"
|
||||
#include "cryptonote_core/cryptonote_core.h"
|
||||
#include "common/hex.h"
|
||||
#include <fmt/std.h>
|
||||
#include <fmt/color.h>
|
||||
|
||||
namespace
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#include "version.h"
|
||||
#include "cryptonote_core/uptime_proof.h"
|
||||
#include <date/date.h>
|
||||
#include <fmt/std.h>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
using namespace cryptonote;
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include "blockchain_db/blockchain_db.h"
|
||||
#include "cryptonote_core/uptime_proof.h"
|
||||
#include "version.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
using namespace cryptonote;
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#include "blocksdat_file.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
using namespace cryptonote;
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
|
||||
#include "bootstrap_serialization.h"
|
||||
#include "serialization/binary_utils.h" // dump_binary(), parse_binary()
|
||||
#include <fmt/std.h>
|
||||
|
||||
#include "bootstrap_file.h"
|
||||
|
||||
|
|
|
@ -42,7 +42,6 @@
|
|||
#include "common/oxen.h"
|
||||
#include "common/file.h"
|
||||
#include "common/hex.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
namespace cryptonote
|
||||
{
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
//
|
||||
#include "file.h"
|
||||
#include "logging/oxen_logger.h"
|
||||
#include <fmt/std.h>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <fstream>
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace fs = ghc::filesystem;
|
|||
namespace formattable {
|
||||
template <> inline constexpr bool via_to_string<ghc::filesystem::path> = true;
|
||||
|
||||
std::string to_string(const ghc::filesystem::path& path) {
|
||||
inline std::string to_string(const ghc::filesystem::path& path) {
|
||||
return path.string();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,15 +128,6 @@ bool parse_int(const std::string_view str, T& value, int base = 10) {
|
|||
return true;
|
||||
}
|
||||
|
||||
/// Converts an integer value into a string via std::to_chars (i.e. without locale).
|
||||
template <typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
|
||||
std::string int_to_string(const T& value, int base = 10) {
|
||||
char buf[8*sizeof(T) + std::is_signed_v<T>]; // maximum possible size with smallest possible base (2)
|
||||
auto [p, ec] = std::to_chars(std::begin(buf), std::end(buf), value, base);
|
||||
assert(ec == std::errc{}); // Our buffer should be big enough for anything
|
||||
return {buf, p};
|
||||
}
|
||||
|
||||
/// Returns a string_view that views the data of the given object; this is not something you want to
|
||||
/// do unless the struct is specifically design to be used this way. The value must be a standard
|
||||
/// layout type; it should really require is_trivial, too, but we have classes (like crypto keys)
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#include "cryptonote_basic/verification_context.h"
|
||||
#include "cryptonote_core/service_node_voting.h"
|
||||
#include "cryptonote_core/oxen_name_system.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
using namespace crypto;
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "epee/string_tools.h"
|
||||
#include "epee/storages/portable_storage_template_helper.h"
|
||||
#include <logging/oxen_logger.h>
|
||||
#include <fmt/std.h>
|
||||
#include <fmt/color.h>
|
||||
|
||||
#define AUTODETECT_WINDOW 10 // seconds
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <sodium.h>
|
||||
#include <fmt/core.h>
|
||||
#include <fmt/color.h>
|
||||
#include <fmt/std.h>
|
||||
|
||||
#include "common/rules.h"
|
||||
#include "common/hex.h"
|
||||
|
|
|
@ -71,7 +71,6 @@ extern "C" {
|
|||
#include "common/i18n.h"
|
||||
#include "epee/net/local_ip.h"
|
||||
#include "logging/oxen_logger.h"
|
||||
#include <fmt/std.h>
|
||||
#include <fmt/color.h>
|
||||
#include <oxenmq/fmt.h>
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <iterator>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <fmt/std.h>
|
||||
#include "common/hex.h"
|
||||
#include "cryptonote_config.h"
|
||||
#include "oxen_name_system.h"
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <chrono>
|
||||
#include <exception>
|
||||
#include <oxenc/base32z.h>
|
||||
#include <oxenc/variant.h>
|
||||
#include <fmt/core.h>
|
||||
#include <date/date.h>
|
||||
#include <fmt/core.h>
|
||||
|
@ -199,7 +200,7 @@ rpc_command_executor::rpc_command_executor(
|
|||
: m_rpc{std::in_place_type<cryptonote::rpc::http_client>, http_url}
|
||||
{
|
||||
if (login)
|
||||
std::get<cryptonote::rpc::http_client>(m_rpc).set_auth(
|
||||
var::get<cryptonote::rpc::http_client>(m_rpc).set_auth(
|
||||
login->username, std::string{login->password.password().view()});
|
||||
}
|
||||
|
||||
|
@ -229,7 +230,7 @@ json rpc_command_executor::invoke(
|
|||
result = rpc_client->json_rpc(method, std::move(params));
|
||||
} else {
|
||||
assert(m_omq);
|
||||
auto conn = std::get<oxenmq::ConnectionID>(m_rpc);
|
||||
auto conn = var::get<oxenmq::ConnectionID>(m_rpc);
|
||||
auto endpoint = (public_method ? "rpc." : "admin.") + std::string{method};
|
||||
std::promise<json> result_p;
|
||||
m_omq->request(conn, endpoint, [&result_p](bool success, auto data) {
|
||||
|
@ -627,12 +628,11 @@ bool rpc_command_executor::print_connections() {
|
|||
|
||||
for (auto& info : conns)
|
||||
{
|
||||
std::string address = info["incoming"].get<bool>() ? "INC " : "OUT ";
|
||||
address += info["ip"].get<std::string_view>();
|
||||
address += ':';
|
||||
address += tools::int_to_string(info["port"].get<uint16_t>());
|
||||
tools::msg_writer() << fmt::format(row_fmt,
|
||||
address,
|
||||
"{} {}:{}"_format(
|
||||
info["incoming"].get<bool>() ? "INC" : "OUT",
|
||||
info["ip"].get<std::string_view>(),
|
||||
info["port"].get<uint16_t>()),
|
||||
get_address_type_name(info["address_type"].get<epee::net_utils::address_type>()),
|
||||
info["peer_id"].get<std::string_view>(),
|
||||
"{}({}/{})"_format(info["recv_count"].get<uint64_t>(),
|
||||
|
@ -1663,7 +1663,7 @@ static void append_printable_service_node_list_entry(cryptonote::network_type ne
|
|||
|
||||
stream << '\n' << indent2 << "Pulse blocks: ";
|
||||
print_votes<std::pair<uint64_t, uint8_t>>(stream, entry, "pulse_votes",
|
||||
[](const auto& val) { return tools::int_to_string(val.first) + (val.second ? " " + tools::int_to_string(val.second) : ""); });
|
||||
[](const auto& val) { return fmt::format(val.second ? "{} {}" : "{}", val.first, val.second); });
|
||||
|
||||
auto print_pass_fail = [&stream, &entry](const std::string& key) {
|
||||
std::pair<int, int> val;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "oxen_logger.h"
|
||||
#include <oxen/log.hpp>
|
||||
#include <fmt/std.h>
|
||||
|
||||
#include <spdlog/sinks/rotating_file_sink.h>
|
||||
#include <filesystem>
|
||||
|
|
|
@ -41,7 +41,6 @@
|
|||
#include <tuple>
|
||||
#include <vector>
|
||||
#include <fmt/color.h>
|
||||
#include <fmt/std.h>
|
||||
|
||||
#include "cryptonote_config.h"
|
||||
#include "version.h"
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "oxenmq/bt_serialize.h"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "rpc/common/rpc_binary.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <oxenc/bt_serialize.h>
|
||||
#include <oxenmq/base64.h>
|
||||
#include <oxenmq/hex.h>
|
||||
#include <type_traits>
|
||||
|
|
|
@ -1314,8 +1314,9 @@ namespace cryptonote::rpc {
|
|||
for (auto h : get.request.heights) {
|
||||
if (h >= curr_height)
|
||||
throw rpc_error{ERROR_TOO_BIG_HEIGHT,
|
||||
"Requested block height: " + tools::int_to_string(h) + " greater than current top block height: " + tools::int_to_string(curr_height - 1)};
|
||||
get.response_hex[tools::int_to_string(h)] = m_core.get_block_id_by_height(h);
|
||||
"Requested block height {} greater than current top block height {}"_format(
|
||||
h, curr_height - 1)};
|
||||
get.response_hex["{}"_format(h)] = m_core.get_block_id_by_height(h);
|
||||
}
|
||||
get.response["status"] = STATUS_OK;
|
||||
}
|
||||
|
@ -2433,7 +2434,7 @@ namespace cryptonote::rpc {
|
|||
"operator_fee", microportion(info.portions_for_operator),
|
||||
"operator_address", cryptonote::get_account_address_as_str(m_core.get_nettype(), false/*subaddress*/, info.operator_address),
|
||||
"swarm_id", info.swarm_id,
|
||||
"swarm", tools::int_to_string(info.swarm_id, 16),
|
||||
"swarm", "{:x}"_format(info.swarm_id),
|
||||
"registration_hf_version", info.registration_hf_version
|
||||
);
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <cpr/ssl_options.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "logging/oxen_logger.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
|
||||
namespace cryptonote::rpc {
|
||||
|
|
|
@ -56,7 +56,6 @@
|
|||
#include <boost/format.hpp>
|
||||
#include <fmt/core.h>
|
||||
#include <oxenc/hex.h>
|
||||
#include <fmt/std.h>
|
||||
#include "epee/console_handler.h"
|
||||
#include "common/i18n.h"
|
||||
#include "common/command_line.h"
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include "wallet_errors.h"
|
||||
#include "ringdb.h"
|
||||
#include "cryptonote_config.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
#define V1TAG ((uint64_t)798237759845202)
|
||||
|
||||
|
|
|
@ -88,7 +88,6 @@
|
|||
#include "oxen_economy.h"
|
||||
#include "logging/oxen_logger.h"
|
||||
#include <fmt/color.h>
|
||||
#include <fmt/std.h>
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
|
|
@ -37,7 +37,6 @@
|
|||
#include "epee/string_tools.h"
|
||||
#include "version.h"
|
||||
#include "logging/oxen_logger.h"
|
||||
#include <fmt/std.h>
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <crtdbg.h>
|
||||
|
|
|
@ -36,7 +36,6 @@
|
|||
#include <chrono>
|
||||
#include <exception>
|
||||
#include <oxenc/base64.h>
|
||||
#include <fmt/std.h>
|
||||
|
||||
#include "wallet_rpc_server_error_codes.h"
|
||||
#include "wallet_rpc_server.h"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include <cryptonote_basic/cryptonote_format_utils.h>
|
||||
#include <common/string_util.h>
|
||||
#include <epee/misc_log_ex.h>
|
||||
#include "oxenmq/oxenmq.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ using nlohmann::json;
|
|||
using cryptonote::rpc::required;
|
||||
using cryptonote::rpc::get_values;
|
||||
|
||||
using rpc_input = std::variant<std::monostate, nlohmann::json, oxenmq::bt_dict_consumer>;
|
||||
using rpc_input = var::variant<std::monostate, nlohmann::json, oxenmq::bt_dict_consumer>;
|
||||
|
||||
|
||||
void parse_request(GET_BALANCE& req, rpc_input in) {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "commands.h"
|
||||
#include <wallet3/config/config.hpp>
|
||||
|
||||
#include <oxenc/variant.h>
|
||||
#include <oxenmq/oxenmq.h>
|
||||
#include <oxenmq/auth.h>
|
||||
|
||||
|
@ -56,7 +57,7 @@ OmqServer::set_omq(std::shared_ptr<oxenmq::OxenMQ> omq_in, wallet::rpc::Config c
|
|||
request.body = m.data[0];
|
||||
|
||||
try {
|
||||
auto result = std::visit([](auto&& v) -> std::string {
|
||||
auto result = var::visit([](auto&& v) -> std::string {
|
||||
using T = decltype(v);
|
||||
if constexpr (std::is_same_v<oxenmq::bt_value&&, T>)
|
||||
return bt_serialize(std::move(v));
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <sqlitedb/database.hpp>
|
||||
#include <oxenmq/oxenmq.h>
|
||||
|
||||
#include <filesystem>
|
||||
#include "common/fs.h"
|
||||
#include <future>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
@ -30,7 +30,7 @@ namespace wallet
|
|||
std::string_view dbPassword,
|
||||
wallet::Config config_in)
|
||||
: omq(omq)
|
||||
, db{std::make_shared<WalletDB>(std::filesystem::path(dbFilename), dbPassword)}
|
||||
, db{std::make_shared<WalletDB>(fs::path(dbFilename), dbPassword)}
|
||||
, keys{keys}
|
||||
, tx_scanner{keys, db}
|
||||
, tx_constructor{tx_constructor}
|
||||
|
|
Loading…
Reference in a new issue