libwallet_api: some renamings

This commit is contained in:
Ilya Kitaev 2016-10-06 15:45:43 +03:00
parent db3282cdf0
commit 8b0cb8caa4
4 changed files with 11 additions and 9 deletions

View File

@ -60,6 +60,7 @@ TransactionHistoryImpl::~TransactionHistoryImpl()
int TransactionHistoryImpl::count() const int TransactionHistoryImpl::count() const
{ {
boost::lock_guard<boost::mutex> guarg(m_historyMutex);
return m_history.size(); return m_history.size();
} }
@ -80,7 +81,7 @@ std::vector<TransactionInfo *> TransactionHistoryImpl::getAll() const
void TransactionHistoryImpl::refresh() void TransactionHistoryImpl::refresh()
{ {
// multithreaded access: // multithreaded access:
boost::lock_guard<boost::mutex> guarg(m_refreshMutex); boost::lock_guard<boost::mutex> guarg(m_historyMutex);
// TODO: configurable values; // TODO: configurable values;
uint64_t min_height = 0; uint64_t min_height = 0;

View File

@ -52,7 +52,7 @@ private:
// TransactionHistory is responsible of memory management // TransactionHistory is responsible of memory management
std::vector<TransactionInfo*> m_history; std::vector<TransactionInfo*> m_history;
WalletImpl *m_wallet; WalletImpl *m_wallet;
boost::mutex m_refreshMutex; mutable boost::mutex m_historyMutex;
}; };
} }

View File

@ -201,7 +201,6 @@ bool WalletImpl::create(const std::string &path, const std::string &password, co
bool keys_file_exists; bool keys_file_exists;
bool wallet_file_exists; bool wallet_file_exists;
tools::wallet2::wallet_exists(path, keys_file_exists, wallet_file_exists); tools::wallet2::wallet_exists(path, keys_file_exists, wallet_file_exists);
// TODO: figure out how to setup logger;
LOG_PRINT_L3("wallet_path: " << path << ""); LOG_PRINT_L3("wallet_path: " << path << "");
LOG_PRINT_L3("keys_file_exists: " << std::boolalpha << keys_file_exists << std::noboolalpha LOG_PRINT_L3("keys_file_exists: " << std::boolalpha << keys_file_exists << std::noboolalpha
<< " wallet_file_exists: " << std::boolalpha << wallet_file_exists << std::noboolalpha); << " wallet_file_exists: " << std::boolalpha << wallet_file_exists << std::noboolalpha);

View File

@ -539,8 +539,10 @@ TEST_F(WalletTest1, WalletReturnsDaemonBlockHeight)
TEST_F(WalletTest1, WalletRefresh) TEST_F(WalletTest1, WalletRefresh)
{ {
std::cout << "Opening wallet: " << CURRENT_SRC_WALLET << std::endl;
Bitmonero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true); Bitmonero::Wallet * wallet1 = wmgr->openWallet(CURRENT_SRC_WALLET, TESTNET_WALLET_PASS, true);
// make sure testnet daemon is running // make sure testnet daemon is running
std::cout << "connecting to daemon: " << TESTNET_DAEMON_ADDRESS << std::endl;
ASSERT_TRUE(wallet1->init(TESTNET_DAEMON_ADDRESS, 0)); ASSERT_TRUE(wallet1->init(TESTNET_DAEMON_ADDRESS, 0));
ASSERT_TRUE(wallet1->refresh()); ASSERT_TRUE(wallet1->refresh());
ASSERT_TRUE(wmgr->closeWallet(wallet1)); ASSERT_TRUE(wmgr->closeWallet(wallet1));
@ -570,13 +572,13 @@ TEST_F(WalletTest1, WalletTransaction)
ASSERT_TRUE(wallet1->status() == Bitmonero::PendingTransaction::Status_Ok); ASSERT_TRUE(wallet1->status() == Bitmonero::PendingTransaction::Status_Ok);
std::string recepient_address = Utils::get_wallet_address(CURRENT_DST_WALLET, TESTNET_WALLET_PASS); std::string recepient_address = Utils::get_wallet_address(CURRENT_DST_WALLET, TESTNET_WALLET_PASS);
wallet1->setDefaultMixin(1); wallet1->setDefaultMixin(10);
ASSERT_TRUE(wallet1->defaultMixin() == 1); ASSERT_TRUE(wallet1->defaultMixin() == 10);
Bitmonero::PendingTransaction * transaction = wallet1->createTransaction(recepient_address, Bitmonero::PendingTransaction * transaction = wallet1->createTransaction(recepient_address,
PAYMENT_ID_EMPTY, PAYMENT_ID_EMPTY,
AMOUNT_10XMR, AMOUNT_10XMR,
1); 2);
ASSERT_TRUE(transaction->status() == Bitmonero::PendingTransaction::Status_Ok); ASSERT_TRUE(transaction->status() == Bitmonero::PendingTransaction::Status_Ok);
wallet1->refresh(); wallet1->refresh();
@ -1146,10 +1148,10 @@ int main(int argc, char** argv)
TESTNET_WALLET5_NAME = WALLETS_ROOT_DIR + "/wallet_05.bin"; TESTNET_WALLET5_NAME = WALLETS_ROOT_DIR + "/wallet_05.bin";
TESTNET_WALLET6_NAME = WALLETS_ROOT_DIR + "/wallet_06.bin"; TESTNET_WALLET6_NAME = WALLETS_ROOT_DIR + "/wallet_06.bin";
CURRENT_SRC_WALLET = TESTNET_WALLET6_NAME; CURRENT_SRC_WALLET = TESTNET_WALLET5_NAME;
CURRENT_DST_WALLET = TESTNET_WALLET5_NAME; CURRENT_DST_WALLET = TESTNET_WALLET1_NAME;
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
// Bitmonero::WalletManagerFactory::setLogLevel(Bitmonero::WalletManagerFactory::LogLevel_Max); Bitmonero::WalletManagerFactory::setLogLevel(Bitmonero::WalletManagerFactory::LogLevel_Max);
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }