forked from lthn/blockchain
fixed bug in mobile wallet: wrong objects references
This commit is contained in:
parent
41452dbb4c
commit
c74cd2d454
6 changed files with 37 additions and 9 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit ea512b08c9166406ae5fd84ae69a6b57c9a03b67
|
||||
Subproject commit 5a8320e580f5510e64e967a8a4f7fb2cbc76194a
|
||||
|
|
@ -1866,6 +1866,7 @@ void wallet2::pull_blocks(size_t& blocks_added, std::atomic<bool>& stop)
|
|||
r = string_tools::parse_tpod_from_hex_string(gbd_res.blocks.back().id, new_genesis_id);
|
||||
THROW_IF_TRUE_WALLET_EX(!r, error::no_connection_to_daemon, "get_blocks_details");
|
||||
reset_all();
|
||||
m_minimum_height = req.minimum_height;
|
||||
m_chain.set_genesis(new_genesis_id);
|
||||
WLT_LOG_MAGENTA("New genesis set for wallet: " << new_genesis_id, LOG_LEVEL_0);
|
||||
m_chain.get_short_chain_history(req.block_ids);
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace tools
|
|||
{
|
||||
virtual void lock() {};
|
||||
virtual void unlock() {};
|
||||
#ifndef MOBILE_WALLET_BUILD
|
||||
//#ifndef MOBILE_WALLET_BUILD
|
||||
virtual std::shared_ptr<wallet2> get_wallet() = 0;
|
||||
#endif
|
||||
//#endif
|
||||
};
|
||||
|
||||
struct wallet_rpc_locker
|
||||
|
|
@ -31,9 +31,9 @@ namespace tools
|
|||
wallet_rpc_locker(i_wallet_provider* wallet_provider) :m_pwallet_provider(wallet_provider)
|
||||
{
|
||||
m_pwallet_provider->lock();
|
||||
#ifndef MOBILE_WALLET_BUILD
|
||||
//#ifndef MOBILE_WALLET_BUILD
|
||||
m_wallet_ptr = m_pwallet_provider->get_wallet();
|
||||
#endif
|
||||
//#endif
|
||||
if (!m_wallet_ptr.get())
|
||||
{
|
||||
throw std::runtime_error("Wallet object closed");
|
||||
|
|
|
|||
|
|
@ -204,9 +204,9 @@ private:
|
|||
//----- i_wallet_provider ------
|
||||
virtual void lock();
|
||||
virtual void unlock();
|
||||
#ifndef MOBILE_WALLET_BUILD
|
||||
//#ifndef MOBILE_WALLET_BUILD
|
||||
virtual std::shared_ptr<tools::wallet2> get_wallet();
|
||||
#endif
|
||||
//#endif
|
||||
//--------
|
||||
|
||||
BEGIN_URI_MAP2_VIRTUAL()
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ target_link_libraries(coretests rpc wallet currency_core common crypto zlibstati
|
|||
target_link_libraries(functional_tests rpc wallet currency_core crypto common zlibstatic ethash libminiupnpc-static ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||
target_link_libraries(hash-tests crypto ethash)
|
||||
target_link_libraries(hash-target-tests crypto currency_core ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||
target_link_libraries(performance_tests wallet currency_core common crypto zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||
target_link_libraries(performance_tests rpc wallet currency_core common crypto zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||
target_link_libraries(unit_tests wallet currency_core common crypto gtest_main zlibstatic ethash ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||
target_link_libraries(net_load_tests_clt currency_core common crypto gtest_main ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||
target_link_libraries(net_load_tests_srv currency_core common crypto gtest_main ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES})
|
||||
|
|
|
|||
|
|
@ -24,6 +24,32 @@
|
|||
#include "free_space_check.h"
|
||||
#include "htlc_hash_tests.h"
|
||||
#include "threads_pool_tests.h"
|
||||
#include "wallet/plain_wallet_api.h"
|
||||
#include "wallet/view_iface.h"
|
||||
|
||||
void test_plain_wallet()
|
||||
{
|
||||
std::string res = plain_wallet::init("195.201.107.230", "33336", "E:\\tmp\\", 0);
|
||||
|
||||
uint64_t instance_id = 0;
|
||||
res = plain_wallet::open("test.zan", "111");
|
||||
while(true)
|
||||
{
|
||||
epee::misc_utils::sleep_no_w(2000);
|
||||
res = plain_wallet::sync_call("get_wallet_status", instance_id, "");
|
||||
view::wallet_sync_status_info wsi = AUTO_VAL_INIT(wsi);
|
||||
epee::serialization::load_t_from_json(wsi, res);
|
||||
if (wsi.wallet_state == 2)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
std::string invoke_body = "{\"method\":\"get_recent_txs_and_info\",\"params\":{\"offset\":0,\"count\":30,\"update_provision_info\":true}}";
|
||||
|
||||
res = plain_wallet::sync_call("invoke", instance_id, invoke_body);
|
||||
LOG_PRINT_L0(res);
|
||||
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
|
@ -35,7 +61,8 @@ int main(int argc, char** argv)
|
|||
epee::log_space::log_singletone::get_default_log_file().c_str(),
|
||||
epee::log_space::log_singletone::get_default_log_folder().c_str());
|
||||
|
||||
parse_weird_tx();
|
||||
test_plain_wallet();
|
||||
//parse_weird_tx();
|
||||
//thread_pool_tests();
|
||||
|
||||
// std::string buf1 = tools::get_varint_data<uint64_t>(CURRENCY_PUBLIC_ADDRESS_BASE58_PREFIX);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue