diff --git a/README b/README index 87a89c58..75c2dce5 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ On *nix: -Dependencies: GCC 4.7.3 or later, CMake 2.8.6 or later, and Boost 1.53 or later (except 1.54, more details here: http://goo.gl/RrCFmA). +Dependencies: GCC 4.7.3 or later, CMake 2.8.6 or later, and Boost 1.55. You may download them from: http://gcc.gnu.org/ http://www.cmake.org/ @@ -18,7 +18,7 @@ Test suite: run `make test-release' to run tests in addition to building. Runnin Building with Clang: it may be possible to use Clang instead of GCC, but this may not work everywhere. To build, run `export CC=clang CXX=clang++' before running `make'. On Windows: -Dependencies: MSVC 2012 or later, CMake 2.8.6 or later, and Boost 1.53 or later. You may download them from: +Dependencies: MSVC 2012 or later, CMake 2.8.6 or later, and Boost 1.55. You may download them from: http://www.microsoft.com/ http://www.cmake.org/ http://www.boost.org/ diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp index ae5ab7df..34f703bf 100644 --- a/src/simplewallet/simplewallet.cpp +++ b/src/simplewallet/simplewallet.cpp @@ -575,7 +575,9 @@ bool simple_wallet::deinit() if (!m_wallet.get()) return true; - return close_wallet(); + bool r = close_wallet(); + m_wallet->shutdown(); + return r; } //---------------------------------------------------------------------------------------------------- void simple_wallet::handle_command_line(const boost::program_options::variables_map& vm) @@ -781,17 +783,24 @@ void simple_wallet::externalTransactionCreated(CryptoNote::TransactionId transac TransactionInfo txInfo; m_wallet->getTransaction(transactionId, txInfo); + if (txInfo.totalAmount >= 0) { message_writer(epee::log_space::console_color_green, false) << "Height " << txInfo.blockHeight << ", transaction " << epee::string_tools::pod_to_hex(txInfo.hash) << - ", received " << m_currency.formatAmount(txInfo.totalAmount); + ", received " << m_currency.formatAmount(static_cast(txInfo.totalAmount)); + } else { + message_writer(epee::log_space::console_color_magenta, false) << + "Height " << txInfo.blockHeight << + ", transaction " << epee::string_tools::pod_to_hex(txInfo.hash) << + ", spent " << m_currency.formatAmount(static_cast(-txInfo.totalAmount)); + } m_refresh_progress_reporter.update(txInfo.blockHeight, true); } //---------------------------------------------------------------------------------------------------- bool simple_wallet::show_balance(const std::vector& args/* = std::vector()*/) { - success_msg_writer() << "balance: " << m_currency.formatAmount(m_wallet->pendingBalance()) << - ", unlocked balance: " << m_currency.formatAmount(m_wallet->actualBalance()); + success_msg_writer() << "available balance: " << m_currency.formatAmount(m_wallet->actualBalance()) << + ", locked amount: " << m_currency.formatAmount(m_wallet->pendingBalance()); return true; } //---------------------------------------------------------------------------------------------------- @@ -1001,7 +1010,6 @@ bool simple_wallet::run() void simple_wallet::stop() { m_cmd_binder.stop_handling(); - m_wallet->shutdown(); } //---------------------------------------------------------------------------------------------------- bool simple_wallet::print_address(const std::vector &args/* = std::vector()*/) @@ -1145,8 +1153,8 @@ int main(int argc, char* argv[]) try { walletFileName = ::tryToOpenWalletOrLoadKeysOrThrow(wallet, wallet_file, wallet_password); - LOG_PRINT_L1("balance: " << currency.formatAmount(wallet->pendingBalance()) << - ", unlocked balance: " << currency.formatAmount(wallet->actualBalance())); + LOG_PRINT_L1("available balance: " << currency.formatAmount(wallet->actualBalance()) << + ", locked amount: " << currency.formatAmount(wallet->pendingBalance())); LOG_PRINT_GREEN("Loaded ok", LOG_LEVEL_0); } catch (const std::exception& e) diff --git a/src/wallet/Wallet.cpp b/src/wallet/Wallet.cpp index b864cb84..dd7522f5 100755 --- a/src/wallet/Wallet.cpp +++ b/src/wallet/Wallet.cpp @@ -223,7 +223,7 @@ void Wallet::initAndLoad(std::istream& source, const std::string& password) { void Wallet::initSync() { AccountSubscription sub; sub.keys = reinterpret_cast(m_account.get_keys()); - sub.transactionSpendableAge = 10; + sub.transactionSpendableAge = 1; sub.syncStart.height = 0; sub.syncStart.timestamp = m_account.get_createtime() - (60 * 60 * 24); diff --git a/tests/unit_tests/TestBlockchainGenerator.cpp b/tests/unit_tests/TestBlockchainGenerator.cpp index 43ccda05..d62314d2 100644 --- a/tests/unit_tests/TestBlockchainGenerator.cpp +++ b/tests/unit_tests/TestBlockchainGenerator.cpp @@ -127,6 +127,7 @@ bool TestBlockchainGenerator::getBlockRewardForAddress(const cryptonote::Account cryptonote::Transaction tx; creator.generate(address, tx); + tx.unlockTime = 10; //default unlock time for coinbase transactions addToBlockchain(tx); diff --git a/tests/unit_tests/test_tx_pool_detach.cpp b/tests/unit_tests/test_tx_pool_detach.cpp index f8fe3efb..55f3f606 100755 --- a/tests/unit_tests/test_tx_pool_detach.cpp +++ b/tests/unit_tests/test_tx_pool_detach.cpp @@ -413,8 +413,8 @@ TEST_F(DetachTest, testDetachWithWallet) { ASSERT_EQ(txInfo.blockHeight, m_node.getLastLocalBlockHeight()); ASSERT_EQ(txInfo.totalAmount, tr.amount); - ASSERT_EQ(Bob.pendingBalance(), tr.amount); - ASSERT_EQ(Bob.actualBalance(), 0); + ASSERT_EQ(Bob.pendingBalance(), 0); + ASSERT_EQ(Bob.actualBalance(), tr.amount); m_node.startAlternativeChain(m_node.getLastLocalBlockHeight() - 1); generator.generateEmptyBlocks(2); diff --git a/tests/unit_tests/test_wallet.cpp b/tests/unit_tests/test_wallet.cpp index eed3e7b9..9ad57005 100644 --- a/tests/unit_tests/test_wallet.cpp +++ b/tests/unit_tests/test_wallet.cpp @@ -1016,8 +1016,8 @@ TEST_F(WalletApi, checkPendingBalance) { bobNode->updateObservers(); ASSERT_NO_FATAL_FAILURE(WaitWalletSync(bobWalletObserver.get())); - ASSERT_EQ(0, bob->actualBalance()); - ASSERT_EQ(sendAmount, bob->pendingBalance()); + ASSERT_EQ(sendAmount, bob->actualBalance()); + ASSERT_EQ(0, bob->pendingBalance()); alice->shutdown(); bob->shutdown();