aboutsummaryrefslogtreecommitdiff
path: root/tests/libwallet_api_tests
diff options
context:
space:
mode:
authorIlya Kitaev <mbg033@gmail.com>2016-09-26 21:35:00 +0300
committerIlya Kitaev <mbg033@gmail.com>2016-09-26 23:19:25 +0300
commit7b4a85b309aa0fb864d63a2fd6f1ae062aaa71dd (patch)
treebd7c073734e9de7b2326ded18bfda73557aaa9eb /tests/libwallet_api_tests
parentlibwallet_api: Wallet::blockChainHeight, WalletListener::newBlock (diff)
downloadmonero-7b4a85b309aa0fb864d63a2fd6f1ae062aaa71dd.tar.xz
wallet2_api: added Wallet::daemonBlockChainHeight()
Diffstat (limited to 'tests/libwallet_api_tests')
-rw-r--r--tests/libwallet_api_tests/main.cpp24
-rwxr-xr-xtests/libwallet_api_tests/scripts/send_funds.sh2
2 files changed, 21 insertions, 5 deletions
diff --git a/tests/libwallet_api_tests/main.cpp b/tests/libwallet_api_tests/main.cpp
index af5549426..7cba5b8b0 100644
--- a/tests/libwallet_api_tests/main.cpp
+++ b/tests/libwallet_api_tests/main.cpp
@@ -489,7 +489,7 @@ TEST_F(WalletTest1, WalletShowsBalance)
ASSERT_TRUE(wmgr->closeWallet(wallet2));
}
-TEST_F(WalletTest1, WalletReturnsBlockHeight)
+TEST_F(WalletTest1, WalletReturnsCurrentBlockHeight)
{
Bitmonero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true);
ASSERT_TRUE(wallet1->blockChainHeight() > 0);
@@ -497,6 +497,24 @@ TEST_F(WalletTest1, WalletReturnsBlockHeight)
}
+TEST_F(WalletTest1, WalletReturnsDaemonBlockHeight)
+{
+ Bitmonero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true);
+ // wallet not connected to daemon
+ ASSERT_TRUE(wallet1->daemonBlockChainHeight() == 0);
+ ASSERT_TRUE(wallet1->status() != Bitmonero::Wallet::Status_Ok);
+ ASSERT_FALSE(wallet1->errorString().empty());
+ wmgr->closeWallet(wallet1);
+
+ wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true);
+ // wallet connected to daemon
+ wallet1->init(TESTNET_DAEMON_ADDRESS, 0);
+ ASSERT_TRUE(wallet1->daemonBlockChainHeight() > 0);
+ std::cout << "daemonBlockChainHeight: " << wallet1->daemonBlockChainHeight() << std::endl;
+ wmgr->closeWallet(wallet1);
+}
+
+
TEST_F(WalletTest1, WalletRefresh)
{
@@ -942,7 +960,7 @@ TEST_F(WalletTest2, WalletCallbackNewBlock)
// make sure testnet daemon is running
ASSERT_TRUE(wallet_src->init(TESTNET_DAEMON_ADDRESS, 0));
ASSERT_TRUE(wallet_src->refresh());
- uint64_t bc1 = wallet_src->blockChainHeight();
+ uint64_t bc1 = wallet_src->currentBlockChainHeight();
std::cout << "** Block height: " << bc1 << std::endl;
@@ -956,7 +974,7 @@ TEST_F(WalletTest2, WalletCallbackNewBlock)
std::cerr << "TEST: newblock lock acquired...\n";
ASSERT_TRUE(wallet_listener->newblock_triggered);
ASSERT_TRUE(wallet_listener->update_triggered);
- uint64_t bc2 = wallet_src->blockChainHeight();
+ uint64_t bc2 = wallet_src->currentBlockChainHeight();
std::cout << "** Block height: " << bc2 << std::endl;
ASSERT_TRUE(bc2 > bc1);
wmgr->closeWallet(wallet_src);
diff --git a/tests/libwallet_api_tests/scripts/send_funds.sh b/tests/libwallet_api_tests/scripts/send_funds.sh
index b7f282b71..3ce923353 100755
--- a/tests/libwallet_api_tests/scripts/send_funds.sh
+++ b/tests/libwallet_api_tests/scripts/send_funds.sh
@@ -1,7 +1,5 @@
#!/bin/bash
-
-
function send_funds {
local amount=$1
local dest=$(cat "$2.address.txt")