mirror of
https://codeberg.org/wownero/wownero-lws
synced 2026-01-09 23:25:16 -08:00
Add unit tests for chain syncing (#87)
This commit is contained in:
committed by
Lee *!* Clagett
parent
c400c9ef8a
commit
e477c174e2
@@ -40,28 +40,35 @@ set(monero-lws-common_headers config.h error.h fwd.h)
|
||||
add_library(monero-lws-common ${monero-lws-common_sources} ${monero-lws-common_headers})
|
||||
target_link_libraries(monero-lws-common monero::libraries)
|
||||
|
||||
|
||||
add_executable(monero-lws-daemon server_main.cpp rest_server.cpp scanner.cpp)
|
||||
target_include_directories(monero-lws-daemon PUBLIC ${ZMQ_INCLUDE_PATH})
|
||||
target_link_libraries(monero-lws-daemon
|
||||
PRIVATE
|
||||
add_library(monero-lws-daemon-common rest_server.cpp scanner.cpp)
|
||||
target_include_directories(monero-lws-daemon-common PUBLIC ${ZMQ_INCLUDE_PATH})
|
||||
target_link_libraries(monero-lws-daemon-common
|
||||
PUBLIC
|
||||
monero::libraries
|
||||
${MONERO_lmdb}
|
||||
monero-lws-common
|
||||
monero-lws-db
|
||||
monero-lws-rpc
|
||||
monero-lws-util
|
||||
monero-lws-wire-json
|
||||
monero-lws-util
|
||||
${Boost_CHRONO_LIBRARY}
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
${Boost_THREAD_LIBRARY}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
${Boost_THREAD_LIBS_INIT}
|
||||
${EXTRA_LIBRARIES}
|
||||
${ZMQ_LIB}
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
add_executable(monero-lws-daemon server_main.cpp)
|
||||
target_link_libraries(monero-lws-daemon
|
||||
PRIVATE
|
||||
monero::libraries
|
||||
monero-lws-daemon-common
|
||||
${Boost_PROGRAM_OPTIONS_LIBRARY}
|
||||
${Boost_FILESYSTEM_LIBRARY}
|
||||
)
|
||||
|
||||
add_executable(monero-lws-admin admin_main.cpp)
|
||||
target_link_libraries(monero-lws-admin
|
||||
PRIVATE
|
||||
|
||||
@@ -31,4 +31,4 @@ set(monero-lws-rpc_headers admin.h client.h daemon_pub.h daemon_zmq.h fwd.h json
|
||||
|
||||
add_library(monero-lws-rpc ${monero-lws-rpc_sources} ${monero-lws-rpc_headers})
|
||||
target_include_directories(monero-lws-rpc PRIVATE ${RMQ_INCLUDE_DIR})
|
||||
target_link_libraries(monero-lws-rpc monero::libraries monero-lws-wire-json monero-lws-wire-wrapper ${RMQ_LIBRARY})
|
||||
target_link_libraries(monero-lws-rpc monero::libraries monero-lws-util monero-lws-wire-json monero-lws-wire-wrapper ${RMQ_LIBRARY})
|
||||
|
||||
@@ -513,6 +513,13 @@ namespace rpc
|
||||
raise_abort_process();
|
||||
}
|
||||
|
||||
void* context::zmq_context() const
|
||||
{
|
||||
if (ctx == nullptr)
|
||||
return nullptr;
|
||||
return ctx->comm.get();
|
||||
}
|
||||
|
||||
std::string const& context::daemon_address() const
|
||||
{
|
||||
if (ctx == nullptr)
|
||||
|
||||
@@ -218,6 +218,9 @@ namespace rpc
|
||||
|
||||
// Do not create clone method, only one of these should exist right now.
|
||||
|
||||
// \return zmq context pointer (for testing).
|
||||
void* zmq_context() const;
|
||||
|
||||
//! \return The full address of the monerod ZMQ daemon.
|
||||
std::string const& daemon_address() const;
|
||||
|
||||
|
||||
@@ -416,15 +416,22 @@ namespace lws
|
||||
|
||||
bool found_pub = false;
|
||||
db::address_index account_index{db::major_index::primary, db::minor_index::primary};
|
||||
crypto::key_derivation active_derived;
|
||||
crypto::key_derivation active_derived{};
|
||||
crypto::public_key active_pub{};
|
||||
|
||||
// inspect the additional and traditional keys
|
||||
for (std::size_t attempt = 0; attempt < 2; ++attempt)
|
||||
{
|
||||
if (attempt == 0)
|
||||
{
|
||||
active_derived = derived;
|
||||
active_pub = key.pub_key;
|
||||
}
|
||||
else if (!additional_derivations.empty())
|
||||
{
|
||||
active_derived = additional_derivations.at(index);
|
||||
active_pub = additional_tx_pub_keys.data.at(index);
|
||||
}
|
||||
else
|
||||
break; // inspection loop
|
||||
|
||||
@@ -491,7 +498,6 @@ namespace lws
|
||||
lws::decrypt_payment_id(payment_id.second.short_, active_derived);
|
||||
}
|
||||
}
|
||||
|
||||
const bool added = output_action(
|
||||
user,
|
||||
db::output{
|
||||
@@ -501,7 +507,7 @@ namespace lws
|
||||
amount,
|
||||
mixin,
|
||||
boost::numeric_cast<std::uint32_t>(index),
|
||||
key.pub_key
|
||||
active_pub
|
||||
},
|
||||
timestamp,
|
||||
tx.unlock_time,
|
||||
|
||||
@@ -56,5 +56,8 @@ namespace lws
|
||||
|
||||
//! Stops all scanner instances globally.
|
||||
static void stop() noexcept { running = false; }
|
||||
|
||||
//! For testing, \post is_running() == true
|
||||
static void reset() noexcept { running = true; }
|
||||
};
|
||||
} // lws
|
||||
|
||||
Reference in New Issue
Block a user