mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-23 18:58:52 +00:00
wallet: rename store-tx-keys to store-tx-info
With backward compatibility
This commit is contained in:
parent
b3d4d41e29
commit
9156ba3a3c
@ -335,7 +335,7 @@ bool simple_wallet::set_always_confirm_transfers(const std::vector<std::string>
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool simple_wallet::set_store_tx_keys(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
bool simple_wallet::set_store_tx_info(const std::vector<std::string> &args/* = std::vector<std::string>()*/)
|
||||||
{
|
{
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if (m_wallet->watch_only())
|
if (m_wallet->watch_only())
|
||||||
@ -359,7 +359,7 @@ bool simple_wallet::set_store_tx_keys(const std::vector<std::string> &args/* = s
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_wallet->store_tx_keys(is_it_true(args[1]));
|
m_wallet->store_tx_info(is_it_true(args[1]));
|
||||||
m_wallet->rewrite(m_wallet_file, pwd_container.password());
|
m_wallet->rewrite(m_wallet_file, pwd_container.password());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -449,7 +449,7 @@ simple_wallet::simple_wallet()
|
|||||||
m_cmd_binder.set_handler("viewkey", boost::bind(&simple_wallet::viewkey, this, _1), tr("Get viewkey"));
|
m_cmd_binder.set_handler("viewkey", boost::bind(&simple_wallet::viewkey, this, _1), tr("Get viewkey"));
|
||||||
m_cmd_binder.set_handler("spendkey", boost::bind(&simple_wallet::spendkey, this, _1), tr("Get spendkey"));
|
m_cmd_binder.set_handler("spendkey", boost::bind(&simple_wallet::spendkey, this, _1), tr("Get spendkey"));
|
||||||
m_cmd_binder.set_handler("seed", boost::bind(&simple_wallet::seed, this, _1), tr("Get deterministic seed"));
|
m_cmd_binder.set_handler("seed", boost::bind(&simple_wallet::seed, this, _1), tr("Get deterministic seed"));
|
||||||
m_cmd_binder.set_handler("set", boost::bind(&simple_wallet::set_variable, this, _1), tr("available options: seed language - Set wallet seed langage; always-confirm-transfers <1|0> - whether to confirm unsplit txes; store-tx-keys <1|0> - whether to store per-tx private keys for future reference; default_mixin <n> - set default mixin (default default is 4"));
|
m_cmd_binder.set_handler("set", boost::bind(&simple_wallet::set_variable, this, _1), tr("available options: seed language - Set wallet seed langage; always-confirm-transfers <1|0> - whether to confirm unsplit txes; store-tx-info <1|0> - whether to store per outgoing tx info (destination address, payment id, tx secret key) for future reference; default_mixin <n> - set default mixin (default default is 4"));
|
||||||
m_cmd_binder.set_handler("rescan_spent", boost::bind(&simple_wallet::rescan_spent, this, _1), tr("Rescan blockchain for spent outputs"));
|
m_cmd_binder.set_handler("rescan_spent", boost::bind(&simple_wallet::rescan_spent, this, _1), tr("Rescan blockchain for spent outputs"));
|
||||||
m_cmd_binder.set_handler("get_tx_key", boost::bind(&simple_wallet::get_tx_key, this, _1), tr("Get transaction key (r) for a given tx"));
|
m_cmd_binder.set_handler("get_tx_key", boost::bind(&simple_wallet::get_tx_key, this, _1), tr("Get transaction key (r) for a given tx"));
|
||||||
m_cmd_binder.set_handler("check_tx_key", boost::bind(&simple_wallet::check_tx_key, this, _1), tr("Check amount going to a given address in a partcular tx"));
|
m_cmd_binder.set_handler("check_tx_key", boost::bind(&simple_wallet::check_tx_key, this, _1), tr("Check amount going to a given address in a partcular tx"));
|
||||||
@ -496,18 +496,18 @@ bool simple_wallet::set_variable(const std::vector<std::string> &args)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args[0] == "store-tx-keys")
|
else if (args[0] == "store-tx-info")
|
||||||
{
|
{
|
||||||
if (args.size() <= 1)
|
if (args.size() <= 1)
|
||||||
{
|
{
|
||||||
fail_msg_writer() << tr("set store-tx-keys: needs an argument (0 or 1)");
|
fail_msg_writer() << tr("set store-tx-info: needs an argument (0 or 1)");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::vector<std::string> local_args = args;
|
std::vector<std::string> local_args = args;
|
||||||
local_args.erase(local_args.begin(), local_args.begin()+2);
|
local_args.erase(local_args.begin(), local_args.begin()+2);
|
||||||
set_store_tx_keys(local_args);
|
set_store_tx_info(local_args);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ namespace cryptonote
|
|||||||
*/
|
*/
|
||||||
bool seed_set_language(const std::vector<std::string> &args = std::vector<std::string>());
|
bool seed_set_language(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool set_always_confirm_transfers(const std::vector<std::string> &args = std::vector<std::string>());
|
bool set_always_confirm_transfers(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool set_store_tx_keys(const std::vector<std::string> &args = std::vector<std::string>());
|
bool set_store_tx_info(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool set_default_mixin(const std::vector<std::string> &args = std::vector<std::string>());
|
bool set_default_mixin(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool help(const std::vector<std::string> &args = std::vector<std::string>());
|
bool help(const std::vector<std::string> &args = std::vector<std::string>());
|
||||||
bool start_mining(const std::vector<std::string> &args);
|
bool start_mining(const std::vector<std::string> &args);
|
||||||
|
@ -295,7 +295,7 @@ void wallet2::process_unconfirmed(const cryptonote::transaction& tx, uint64_t he
|
|||||||
crypto::hash txid = get_transaction_hash(tx);
|
crypto::hash txid = get_transaction_hash(tx);
|
||||||
auto unconf_it = m_unconfirmed_txs.find(txid);
|
auto unconf_it = m_unconfirmed_txs.find(txid);
|
||||||
if(unconf_it != m_unconfirmed_txs.end()) {
|
if(unconf_it != m_unconfirmed_txs.end()) {
|
||||||
if (store_tx_keys()) {
|
if (store_tx_info()) {
|
||||||
try {
|
try {
|
||||||
m_confirmed_txs.insert(std::make_pair(txid, confirmed_transfer_details(unconf_it->second, height)));
|
m_confirmed_txs.insert(std::make_pair(txid, confirmed_transfer_details(unconf_it->second, height)));
|
||||||
}
|
}
|
||||||
@ -570,8 +570,8 @@ bool wallet2::store_keys(const std::string& keys_file_name, const std::string& p
|
|||||||
value2.SetInt(m_always_confirm_transfers ? 1 :0);
|
value2.SetInt(m_always_confirm_transfers ? 1 :0);
|
||||||
json.AddMember("always_confirm_transfers", value2, json.GetAllocator());
|
json.AddMember("always_confirm_transfers", value2, json.GetAllocator());
|
||||||
|
|
||||||
value2.SetInt(m_store_tx_keys ? 1 :0);
|
value2.SetInt(m_store_tx_info ? 1 :0);
|
||||||
json.AddMember("store_tx_keys", value2, json.GetAllocator());
|
json.AddMember("store_tx_info", value2, json.GetAllocator());
|
||||||
|
|
||||||
value2.SetUint(m_default_mixin);
|
value2.SetUint(m_default_mixin);
|
||||||
json.AddMember("default_mixin", value2, json.GetAllocator());
|
json.AddMember("default_mixin", value2, json.GetAllocator());
|
||||||
@ -657,7 +657,8 @@ void wallet2::load_keys(const std::string& keys_file_name, const std::string& pa
|
|||||||
m_watch_only = false;
|
m_watch_only = false;
|
||||||
}
|
}
|
||||||
m_always_confirm_transfers = json.HasMember("always_confirm_transfers") && (json["always_confirm_transfers"].GetInt() != 0);
|
m_always_confirm_transfers = json.HasMember("always_confirm_transfers") && (json["always_confirm_transfers"].GetInt() != 0);
|
||||||
m_store_tx_keys = json.HasMember("store_tx_keys") && (json["store_tx_keys"].GetInt() != 0);
|
m_store_tx_info = (json.HasMember("store_tx_keys") && (json["store_tx_keys"].GetInt() != 0))
|
||||||
|
|| (json.HasMember("store_tx_info") && (json["store_tx_info"].GetInt() != 0));
|
||||||
m_default_mixin = json.HasMember("default_mixin") ? json["default_mixin"].GetUint() : 0;
|
m_default_mixin = json.HasMember("default_mixin") ? json["default_mixin"].GetUint() : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1408,13 +1409,13 @@ void wallet2::commit_tx(pending_tx& ptx)
|
|||||||
txid = get_transaction_hash(ptx.tx);
|
txid = get_transaction_hash(ptx.tx);
|
||||||
crypto::hash payment_id = cryptonote::null_hash;
|
crypto::hash payment_id = cryptonote::null_hash;
|
||||||
std::vector<cryptonote::tx_destination_entry> dests;
|
std::vector<cryptonote::tx_destination_entry> dests;
|
||||||
if (store_tx_keys())
|
if (store_tx_info())
|
||||||
{
|
{
|
||||||
payment_id = get_payment_id(ptx);
|
payment_id = get_payment_id(ptx);
|
||||||
dests = ptx.dests;
|
dests = ptx.dests;
|
||||||
}
|
}
|
||||||
add_unconfirmed_tx(ptx.tx, dests, payment_id, ptx.change_dts.amount);
|
add_unconfirmed_tx(ptx.tx, dests, payment_id, ptx.change_dts.amount);
|
||||||
if (store_tx_keys())
|
if (store_tx_info())
|
||||||
m_tx_keys.insert(std::make_pair(txid, ptx.tx_key));
|
m_tx_keys.insert(std::make_pair(txid, ptx.tx_key));
|
||||||
|
|
||||||
LOG_PRINT_L2("transaction " << txid << " generated ok and sent to daemon, key_images: [" << ptx.key_images << "]");
|
LOG_PRINT_L2("transaction " << txid << " generated ok and sent to daemon, key_images: [" << ptx.key_images << "]");
|
||||||
|
@ -79,9 +79,9 @@ namespace tools
|
|||||||
|
|
||||||
class wallet2
|
class wallet2
|
||||||
{
|
{
|
||||||
wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_keys(false), m_default_mixin(0) {}
|
wallet2(const wallet2&) : m_run(true), m_callback(0), m_testnet(false), m_always_confirm_transfers (false), m_store_tx_info(false), m_default_mixin(0) {}
|
||||||
public:
|
public:
|
||||||
wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_restricted(restricted), is_old_file_format(false), m_store_tx_keys(false), m_default_mixin(0) {}
|
wallet2(bool testnet = false, bool restricted = false) : m_run(true), m_callback(0), m_testnet(testnet), m_restricted(restricted), is_old_file_format(false), m_store_tx_info(false), m_default_mixin(0) {}
|
||||||
struct transfer_details
|
struct transfer_details
|
||||||
{
|
{
|
||||||
uint64_t m_block_height;
|
uint64_t m_block_height;
|
||||||
@ -314,8 +314,8 @@ namespace tools
|
|||||||
|
|
||||||
bool always_confirm_transfers() const { return m_always_confirm_transfers; }
|
bool always_confirm_transfers() const { return m_always_confirm_transfers; }
|
||||||
void always_confirm_transfers(bool always) { m_always_confirm_transfers = always; }
|
void always_confirm_transfers(bool always) { m_always_confirm_transfers = always; }
|
||||||
bool store_tx_keys() const { return m_store_tx_keys; }
|
bool store_tx_info() const { return m_store_tx_info; }
|
||||||
void store_tx_keys(bool store) { m_store_tx_keys = store; }
|
void store_tx_info(bool store) { m_store_tx_info = store; }
|
||||||
uint32_t default_mixin() const { return m_default_mixin; }
|
uint32_t default_mixin() const { return m_default_mixin; }
|
||||||
void default_mixin(uint32_t m) { m_default_mixin = m; }
|
void default_mixin(uint32_t m) { m_default_mixin = m; }
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ namespace tools
|
|||||||
bool is_old_file_format; /*!< Whether the wallet file is of an old file format */
|
bool is_old_file_format; /*!< Whether the wallet file is of an old file format */
|
||||||
bool m_watch_only; /*!< no spend key */
|
bool m_watch_only; /*!< no spend key */
|
||||||
bool m_always_confirm_transfers;
|
bool m_always_confirm_transfers;
|
||||||
bool m_store_tx_keys; /*!< request txkey to be returned in RPC, and store in the wallet cache file */
|
bool m_store_tx_info; /*!< request txkey to be returned in RPC, and store in the wallet cache file */
|
||||||
uint32_t m_default_mixin;
|
uint32_t m_default_mixin;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user