aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/simplewallet/simplewallet.cpp11
-rw-r--r--src/wallet/api/wallet.cpp15
-rw-r--r--src/wallet/wallet2_api.h1
3 files changed, 21 insertions, 6 deletions
diff --git a/src/simplewallet/simplewallet.cpp b/src/simplewallet/simplewallet.cpp
index 36d1fa0a9..1840e54c9 100644
--- a/src/simplewallet/simplewallet.cpp
+++ b/src/simplewallet/simplewallet.cpp
@@ -76,6 +76,13 @@ typedef cryptonote::simple_wallet sw;
#define DEFAULT_MIX 4
+// workaround for a suspected bug in pthread/kernel on MacOS X
+#ifdef __APPLE__
+#define DEFAULT_MAX_CONCURRENCY 1
+#else
+#define DEFAULT_MAX_CONCURRENCY 0
+#endif
+
#define LOCK_IDLE_SCOPE() \
bool auto_refresh_enabled = m_auto_refresh_enabled.load(std::memory_order_relaxed); \
m_auto_refresh_enabled.store(false, std::memory_order_relaxed); \
@@ -95,7 +102,7 @@ typedef cryptonote::simple_wallet sw;
namespace
{
const command_line::arg_descriptor<std::string> arg_wallet_file = {"wallet-file", sw::tr("Use wallet <arg>"), ""};
- const command_line::arg_descriptor<std::string> arg_generate_new_wallet = {"generate-new-wallet", sw::tr("Generate new wallet and save it to <arg> or <address>.wallet by default"), ""};
+ const command_line::arg_descriptor<std::string> arg_generate_new_wallet = {"generate-new-wallet", sw::tr("Generate new wallet and save it to <arg>"), ""};
const command_line::arg_descriptor<std::string> arg_generate_from_view_key = {"generate-from-view-key", sw::tr("Generate incoming-only wallet from view key"), ""};
const command_line::arg_descriptor<std::string> arg_generate_from_keys = {"generate-from-keys", sw::tr("Generate wallet from private keys"), ""};
const command_line::arg_descriptor<std::string> arg_generate_from_json = {"generate-from-json", sw::tr("Generate wallet from JSON format file"), ""};
@@ -108,7 +115,7 @@ namespace
const command_line::arg_descriptor<bool> arg_non_deterministic = {"non-deterministic", sw::tr("Create non-deterministic view and spend keys"), false};
const command_line::arg_descriptor<int> arg_daemon_port = {"daemon-port", sw::tr("Use daemon instance at port <arg> instead of 18081"), 0};
const command_line::arg_descriptor<uint32_t> arg_log_level = {"log-level", "", LOG_LEVEL_0};
- const command_line::arg_descriptor<uint32_t> arg_max_concurrency = {"max-concurrency", "Max number of threads to use for a parallel job", 0};
+ const command_line::arg_descriptor<uint32_t> arg_max_concurrency = {"max-concurrency", "Max number of threads to use for a parallel job", DEFAULT_MAX_CONCURRENCY};
const command_line::arg_descriptor<std::string> arg_log_file = {"log-file", sw::tr("Specify log file"), ""};
const command_line::arg_descriptor<bool> arg_testnet = {"testnet", sw::tr("For testnet. Daemon must also be launched with --testnet flag"), false};
const command_line::arg_descriptor<bool> arg_restricted = {"restricted-rpc", sw::tr("Restricts RPC to view-only commands"), false};
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 4b97e2f1d..b3ee4112b 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -129,7 +129,7 @@ string Wallet::displayAmount(uint64_t amount)
uint64_t Wallet::amountFromString(const string &amount)
{
- uint64_t result;
+ uint64_t result = 0;
cryptonote::parse_amount(result, amount);
return result;
}
@@ -154,6 +154,11 @@ bool Wallet::paymentIdValid(const string &paiment_id)
return tools::wallet2::parse_short_payment_id(paiment_id, pid);
}
+uint64_t Wallet::maximumAllowedAmount()
+{
+ return std::numeric_limits<uint64_t>::max();
+}
+
///////////////////////// WalletImpl implementation ////////////////////////
WalletImpl::WalletImpl(bool testnet)
@@ -267,16 +272,18 @@ bool WalletImpl::recover(const std::string &path, const std::string &seed)
bool WalletImpl::close()
{
- clearStatus();
+
bool result = false;
try {
- // LOG_PRINT_L0("Calling wallet::store...");
- m_wallet->store();
+ // do not store wallet with invalid status
+ if (status() == Status_Ok)
+ m_wallet->store();
// LOG_PRINT_L0("wallet::store done");
// LOG_PRINT_L0("Calling wallet::stop...");
m_wallet->stop();
// LOG_PRINT_L0("wallet::stop done");
result = true;
+ clearStatus();
} catch (const std::exception &e) {
m_status = Status_Error;
m_errorString = e.what();
diff --git a/src/wallet/wallet2_api.h b/src/wallet/wallet2_api.h
index 2c5836573..e880b1c68 100644
--- a/src/wallet/wallet2_api.h
+++ b/src/wallet/wallet2_api.h
@@ -216,6 +216,7 @@ struct Wallet
static uint64_t amountFromDouble(double amount);
static std::string genPaymentId();
static bool paymentIdValid(const std::string &paiment_id);
+ static uint64_t maximumAllowedAmount();
/**
* @brief refresh - refreshes the wallet, updating transactions from daemon