Monero
Loading...
Searching...
No Matches
simplewallet.cpp File Reference

Source file that defines simple_wallet class. More...

#include <boost/bind.hpp>
#include <locale.h>
#include <thread>
#include <iostream>
#include <sstream>
#include <fstream>
#include <ctype.h>
#include <boost/lexical_cast.hpp>
#include <boost/program_options.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/format.hpp>
#include <boost/regex.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <boost/filesystem.hpp>
#include "include_base_utils.h"
#include "console_handler.h"
#include "common/i18n.h"
#include "common/command_line.h"
#include "common/util.h"
#include "common/dns_utils.h"
#include "common/base58.h"
#include "common/scoped_message_writer.h"
#include "cryptonote_protocol/cryptonote_protocol_handler.h"
#include "simplewallet.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "storages/http_abstract_invoke.h"
#include "rpc/core_rpc_server_commands_defs.h"
#include "rpc/rpc_payment_signature.h"
#include "crypto/crypto.h"
#include "mnemonics/electrum-words.h"
#include "rapidjson/document.h"
#include "common/json_util.h"
#include "ringct/rctSigs.h"
#include "multisig/multisig.h"
#include "wallet/wallet_args.h"
#include "version.h"
#include <stdexcept>
#include "wallet/message_store.h"
#include "QrCode.hpp"
Include dependency graph for simplewallet.cpp:

Macros

#define BOOST_BIND_GLOBAL_PLACEHOLDERS   1
#define MONERO_DEFAULT_LOG_CATEGORY   "wallet.simplewallet"
#define EXTENDED_LOGS_FILE   "wallet_details.log"
#define OLD_AGE_WARN_THRESHOLD   (30 * 86400 / DIFFICULTY_TARGET_V2)
#define LOCK_IDLE_SCOPE()
#define SCOPED_WALLET_UNLOCK_ON_BAD_PASSWORD(code)
#define SCOPED_WALLET_UNLOCK()
#define PRINT_USAGE(usage_help)
#define LONG_PAYMENT_ID_SUPPORT_CHECK()
#define REFRESH_PERIOD   90
#define CREDITS_TARGET   50000
#define MAX_PAYMENT_DIFF   10000
#define MIN_PAYMENT_RATE   0.01f
#define MAX_MNEW_ADDRESSES   65536
#define CHECK_MULTISIG_ENABLED()
#define CHECK_IF_BACKGROUND_SYNCING(msg)
#define PRINT_UTF8(pre, x)
#define WTEXTON()
#define WTEXTOFF()
#define CHECK_SIMPLE_VARIABLE(name, f, help)

Typedefs

typedef cryptonote::simple_wallet sw

Functions

static std::string get_human_readable_timespan (std::chrono::seconds seconds)
static std::string get_human_readable_timespan (uint64_t seconds)
bool parse_priority (const std::string &arg, uint32_t &priority)
std::string join_priority_strings (const char *delimiter)
static bool might_be_partial_seed (const epee::wipeable_string &words)
static bool datestr_to_int (const std::string &heightstr, uint16_t &year, uint8_t &month, uint8_t &day)
std::string get_tx_key_stream (crypto::secret_key tx_key, std::vector< crypto::secret_key > additional_tx_keys)
int main (int argc, char *argv[])

Detailed Description

Source file that defines simple_wallet class.

Macro Definition Documentation

◆ BOOST_BIND_GLOBAL_PLACEHOLDERS

#define BOOST_BIND_GLOBAL_PLACEHOLDERS   1

◆ CHECK_IF_BACKGROUND_SYNCING

#define CHECK_IF_BACKGROUND_SYNCING ( msg)
Value:
do \
{ \
if (m_wallet->is_background_wallet() || m_wallet->is_background_syncing()) \
{ \
std::string type = m_wallet->is_background_wallet() ? "background wallet" : "background syncing wallet"; \
fail_msg_writer() << boost::format(tr("%s %s")) % type % msg; \
return false; \
} \
} while (0)
#define tr(x)
Definition common_defines.h:4

◆ CHECK_MULTISIG_ENABLED

#define CHECK_MULTISIG_ENABLED ( )
Value:
do \
{ \
if (!m_wallet->is_multisig_enabled()) \
{ \
fail_msg_writer() << tr("Multisig is disabled."); \
fail_msg_writer() << tr("Multisig is an experimental feature and may have bugs. Things that could go wrong include: funds sent to a multisig wallet can't be spent at all, can only be spent with the participation of a malicious group member, or can be stolen by a malicious group member."); \
fail_msg_writer() << tr("You can enable it with:"); \
fail_msg_writer() << tr(" set enable-multisig-experimental 1"); \
return false; \
} \
} while(0)

◆ CHECK_SIMPLE_VARIABLE

#define CHECK_SIMPLE_VARIABLE ( name,
f,
help )
Value:
do \
if (args[0] == name) { \
if (args.size() <= 1) \
{ \
fail_msg_writer() << "set " << #name << ": " << tr("needs an argument") << " (" << help << ")"; \
return true; \
} \
else \
{ \
f(args); \
return true; \
} \
} while(0)
const char * name
Definition options.c:30

◆ CREDITS_TARGET

#define CREDITS_TARGET   50000

◆ EXTENDED_LOGS_FILE

#define EXTENDED_LOGS_FILE   "wallet_details.log"

◆ LOCK_IDLE_SCOPE

#define LOCK_IDLE_SCOPE ( )
Value:
bool auto_refresh_enabled = m_auto_refresh_enabled.load(std::memory_order_relaxed); \
m_auto_refresh_enabled.store(false, std::memory_order_relaxed); \
/* stop any background refresh and other processes, and take over */ \
m_suspend_rpc_payment_mining.store(true, std::memory_order_relaxed); \
m_wallet->stop(); \
boost::unique_lock<boost::mutex> lock(m_idle_mutex); \
m_idle_cond.notify_all(); \
/* m_idle_mutex is still locked here */ \
m_auto_refresh_enabled.store(auto_refresh_enabled, std::memory_order_relaxed); \
m_suspend_rpc_payment_mining.store(false, std::memory_order_relaxed); \
m_rpc_payment_checker.trigger(); \
m_idle_cond.notify_one(); \
})
boost::shared_ptr< call_befor_die_base > auto_scope_leave_caller
Definition misc_language.h:80
auto_scope_leave_caller create_scope_leave_handler(t_scope_leave_handler f)
Definition misc_language.h:97

◆ LONG_PAYMENT_ID_SUPPORT_CHECK

#define LONG_PAYMENT_ID_SUPPORT_CHECK ( )
Value:
do { \
fail_msg_writer() << tr("Error: Long payment IDs are obsolete."); \
fail_msg_writer() << tr("Long payment IDs were not encrypted on the blockchain and would harm your privacy."); \
fail_msg_writer() << tr("If the party you're sending to still requires a long payment ID, please notify them."); \
return true; \
} while(0)

◆ MAX_MNEW_ADDRESSES

#define MAX_MNEW_ADDRESSES   65536

◆ MAX_PAYMENT_DIFF

#define MAX_PAYMENT_DIFF   10000

◆ MIN_PAYMENT_RATE

#define MIN_PAYMENT_RATE   0.01f

◆ MONERO_DEFAULT_LOG_CATEGORY

#define MONERO_DEFAULT_LOG_CATEGORY   "wallet.simplewallet"

◆ OLD_AGE_WARN_THRESHOLD

#define OLD_AGE_WARN_THRESHOLD   (30 * 86400 / DIFFICULTY_TARGET_V2)

◆ PRINT_USAGE

#define PRINT_USAGE ( usage_help)
Value:
fail_msg_writer() << boost::format(tr("usage: %s")) % usage_help;

◆ PRINT_UTF8

#define PRINT_UTF8 ( pre,
x )
Value:
std::cout << x

◆ REFRESH_PERIOD

#define REFRESH_PERIOD   90

◆ SCOPED_WALLET_UNLOCK

#define SCOPED_WALLET_UNLOCK ( )
Value:
#define SCOPED_WALLET_UNLOCK_ON_BAD_PASSWORD(code)
Definition simplewallet.cpp:120

◆ SCOPED_WALLET_UNLOCK_ON_BAD_PASSWORD

#define SCOPED_WALLET_UNLOCK_ON_BAD_PASSWORD ( code)
Value:
boost::optional<tools::password_container> pwd_container = boost::none; \
if (m_wallet->ask_password() && !(pwd_container = get_and_verify_password())) { code; } \
tools::wallet_keys_unlocker unlocker(*m_wallet, pwd_container);
Definition wallet2.h:124
const portMappingElt code
Definition portlistingparse.c:22
#define LOCK_IDLE_SCOPE()
Definition simplewallet.cpp:104

◆ WTEXTOFF

#define WTEXTOFF ( )

◆ WTEXTON

#define WTEXTON ( )

Typedef Documentation

◆ sw

Function Documentation

◆ datestr_to_int()

bool datestr_to_int ( const std::string & heightstr,
uint16_t & year,
uint8_t & month,
uint8_t & day )
static

◆ get_human_readable_timespan() [1/2]

std::string get_human_readable_timespan ( std::chrono::seconds seconds)
static

◆ get_human_readable_timespan() [2/2]

std::string get_human_readable_timespan ( uint64_t seconds)
static

◆ get_tx_key_stream()

std::string get_tx_key_stream ( crypto::secret_key tx_key,
std::vector< crypto::secret_key > additional_tx_keys )

◆ join_priority_strings()

std::string join_priority_strings ( const char * delimiter)

◆ main()

int main ( int argc,
char * argv[] )

◆ might_be_partial_seed()

bool might_be_partial_seed ( const epee::wipeable_string & words)
static

◆ parse_priority()

bool parse_priority ( const std::string & arg,
uint32_t & priority )