aboutsummaryrefslogtreecommitdiff
path: root/tests/libwallet_api_tests/main.cpp
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-09-30 22:42:15 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-09-30 22:42:15 +0300
commit10fe626e13297d9712763a51174cd6437185e53d (patch)
tree7e5519eb9a12f423eb3e33ce328c1dc0d272dd90 /tests/libwallet_api_tests/main.cpp
parentlibwallet_api: fix unhandled exception on address check (diff)
downloadmonero-10fe626e13297d9712763a51174cd6437185e53d.tar.xz
libwallet_api: fast-refresh in case of opening non-synced wallet
Diffstat (limited to '')
-rw-r--r--tests/libwallet_api_tests/main.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp
index 42445d53a..a4b881407 100644
--- a/tests/libwallet_api_tests/main.cpp
+++ b/tests/libwallet_api_tests/main.cpp
@@ -1030,7 +1030,7 @@ TEST_F(WalletManagerMainnetTest, CreateOpenAndRefreshWalletMainNetSync)
}
-TEST_F(WalletManagerMainnetTest, CreateOpenAndRefreshWalletMainNetAsync)
+TEST_F(WalletManagerMainnetTest, CreateAndRefreshWalletMainNetAsync)
{
Bitmonero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG);
@@ -1049,6 +1049,30 @@ TEST_F(WalletManagerMainnetTest, CreateOpenAndRefreshWalletMainNetAsync)
wmgr->closeWallet(wallet);
}
+TEST_F(WalletManagerMainnetTest, OpenAndRefreshWalletMainNetAsync)
+{
+
+ Bitmonero::Wallet * wallet = wmgr->createWallet(WALLET_NAME_MAINNET, "", WALLET_LANG);
+
+ wmgr->closeWallet(wallet);
+ wallet = wmgr->openWallet(WALLET_NAME_MAINNET, "");
+
+ MyWalletListener * wallet_listener = new MyWalletListener(wallet);
+ std::chrono::seconds wait_for = std::chrono::seconds(30);
+ std::unique_lock<std::mutex> lock (wallet_listener->mutex);
+ wallet->initAsync(MAINNET_DAEMON_ADDRESS, 0);
+ // wallet->init(MAINNET_DAEMON_ADDRESS, 0);
+ std::cerr << "TEST: waiting on refresh lock...\n";
+ wallet_listener->cv_refresh.wait_for(lock, wait_for);
+ std::cerr << "TEST: refresh lock acquired...\n";
+ ASSERT_TRUE(wallet_listener->refresh_triggered);
+ ASSERT_TRUE(wallet->connected());
+ ASSERT_TRUE(wallet->blockChainHeight() == wallet->daemonBlockChainHeight());
+ std::cerr << "TEST: closing wallet...\n";
+ wmgr->closeWallet(wallet);
+}
+
+
int main(int argc, char** argv)