diff --git a/src/httpserver.h b/src/httpserver.h --- a/src/httpserver.h +++ b/src/httpserver.h @@ -147,6 +147,4 @@ struct event *ev; }; -std::string urlDecode(const std::string &urlEncoded); - #endif // BITCOIN_HTTPSERVER_H diff --git a/src/httpserver.cpp b/src/httpserver.cpp --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -657,15 +657,3 @@ pathHandlers.erase(i); } } - -std::string urlDecode(const std::string &urlEncoded) { - std::string res; - if (!urlEncoded.empty()) { - char *decoded = evhttp_uridecode(urlEncoded.c_str(), false, nullptr); - if (decoded) { - res = std::string(decoded); - free(decoded); - } - } - return res; -} diff --git a/src/wallet/CMakeLists.txt b/src/wallet/CMakeLists.txt --- a/src/wallet/CMakeLists.txt +++ b/src/wallet/CMakeLists.txt @@ -12,7 +12,15 @@ walletdb.cpp ) +target_link_libraries(wallet util univalue) + # Add Berkeley DB dependency find_package(BerkeleyDB REQUIRED) target_include_directories(wallet PRIVATE ${BDB_INCLUDE_DIR}) -target_link_libraries(wallet util univalue ${BDBXX_LIBRARY} ${BDB_LIBRARY}) +target_link_libraries(wallet ${BDBXX_LIBRARY} ${BDB_LIBRARY}) + +# Add event dependency. This is only required for evhttp_uridecode +# in rpcwallet.cpp so it may be worth considering using an alternative. +find_package(Event REQUIRED) +target_include_directories(wallet PRIVATE ${EVENT_INCLUDE_DIR}) +target_link_libraries(wallet ${EVENT_LIBRARY}) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -10,7 +10,6 @@ #include "consensus/validation.h" #include "core_io.h" #include "dstencode.h" -#include "httpserver.h" #include "init.h" #include "net.h" #include "policy/fees.h" @@ -27,8 +26,22 @@ #include +#include + static const std::string WALLET_ENDPOINT_BASE = "/wallet/"; +static std::string urlDecode(const std::string &urlEncoded) { + std::string res; + if (!urlEncoded.empty()) { + char *decoded = evhttp_uridecode(urlEncoded.c_str(), false, nullptr); + if (decoded) { + res = std::string(decoded); + free(decoded); + } + } + return res; +} + CWallet *GetWalletForJSONRPCRequest(const JSONRPCRequest &request) { if (request.URI.substr(0, WALLET_ENDPOINT_BASE.size()) == WALLET_ENDPOINT_BASE) {