1
0
Fork 0
forked from lthn/blockchain

multiple fixes over wallet and cmake

This commit is contained in:
cryptozoidberg 2022-11-18 21:04:05 +01:00
parent bf3430b49b
commit 059c367d89
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
7 changed files with 18 additions and 13 deletions

View file

@ -5,9 +5,14 @@ PROJECT(Zano)
set(VERSION "1.0")
# if(POLICY CMP0043)
# cmake_policy(SET CMP0043 OLD)
# endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0043 NEW)
endif()
if(POLICY CMP0043)
cmake_policy(SET CMP0074 NEW)
endif()
# if(POLICY CMP0020)
# cmake_policy(SET CMP0020 OLD)
@ -50,6 +55,7 @@ message("Generated with config types: ${CMAKE_CONFIGURATION_TYPES}, and built ty
enable_testing()
find_package(OpenSSL REQUIRED)
if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10.5)

View file

@ -1072,7 +1072,7 @@ namespace epee
return false;
}
inline
bool fetch_url(const std::string& url, std::string& response_body, const std::string& method = "GET", const std::string& request_body = "", unsigned int timeout = 1000)
{
try

View file

@ -158,7 +158,7 @@ add_dependencies(stratum version ${PCH_LIB_NAME})
ENABLE_SHARED_PCH(stratum STRATUM)
target_link_libraries(currency_core lmdb mdbx OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(currency_core lmdb mdbx)
add_executable(daemon ${DAEMON} ${P2P} ${CURRENCY_PROTOCOL})
add_dependencies(daemon version)
@ -199,7 +199,7 @@ if(BUILD_GUI)
QT5_USE_MODULES(Zano WebEngineWidgets WebChannel)
find_package(Qt5PrintSupport REQUIRED)
target_link_libraries(Zano wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(Zano wallet rpc currency_core crypto common zlibstatic ethash Qt5::WebEngineWidgets Qt5::PrintSupport ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES} OpenSSL::SSL OpenSSL::Crypto)
if (UNIX AND NOT APPLE)
target_link_libraries(Zano rt)
endif()

View file

@ -215,7 +215,7 @@ public:
struct wallet_info
{
std::vector<tools::wallet_public::asset_balance_entry> balances;
std::list<tools::wallet_public::asset_balance_entry> balances;
uint64_t mined_total;
std::string address;
std::string view_sec_key;

View file

@ -3125,13 +3125,13 @@ bool wallet2::balance(std::unordered_map<crypto::hash, wallet_public::asset_bala
return true;
}
//----------------------------------------------------------------------------------------------------
bool wallet2::balance(std::vector<wallet_public::asset_balance_entry>& balances, uint64_t& mined)
bool wallet2::balance(std::list<wallet_public::asset_balance_entry>& balances, uint64_t& mined) const
{
std::unordered_map<crypto::hash, wallet_public::asset_balance_entry_base> balances_map;
this->balance(balances_map, mined);
for (const auto& item : balances_map)
{
asset_descriptor_base* asset_ptr = nullptr;
const asset_descriptor_base* asset_ptr = nullptr;
//check if asset is whitelisted or customly added
auto it = m_whitelisted_assets.find(item.first);
if (it == m_whitelisted_assets.end())
@ -3154,10 +3154,10 @@ bool wallet2::balance(std::vector<wallet_public::asset_balance_entry>& balances,
balances.push_back(wallet_public::asset_balance_entry());
wallet_public::asset_balance_entry& new_item = balances.back();
static_cast<asset_balance_entry_base&>(new_item) = item.second;
static_cast<wallet_public::asset_balance_entry_base&>(new_item) = item.second;
new_item.asset_info.asset_id = item.first;
CHECK_AND_ASSERT_THROW_MES(asset_ptr, "Internal error: asset_ptr i nullptr");
static_cast<asset_descriptor_base&>(new_item.asset_info) = *asset_ptr;
static_cast<currency::asset_descriptor_base&>(new_item.asset_info) = *asset_ptr;
}
return true;

View file

@ -566,7 +566,7 @@ namespace tools
uint64_t balance() const;
uint64_t balance(uint64_t& unloked, uint64_t& awaiting_in, uint64_t& awaiting_out, uint64_t& mined) const;
bool balance(std::unordered_map<crypto::hash, wallet_public::asset_balance_entry_base>& balances, uint64_t& mined) const;
bool balance(std::vector<wallet_public::asset_balance_entry>& balances, uint64_t& mined) const;
bool balance(std::list<wallet_public::asset_balance_entry>& balances, uint64_t& mined) const;
uint64_t balance(uint64_t& unloked) const;

View file

@ -189,7 +189,6 @@ namespace tools
// res.balance = m_wallet.balance();
// res.unlocked_balance = m_wallet.unlocked_balance();
uint64_t mined = 0;
// std::unordered_map<crypto::hash, wallet_public::asset_balance_entry_base> balances;
m_wallet.balance(res.balances, mined);
for (auto it = res.balances.begin(); it != res.balances.end(); it++)
{