Skip to content

Commit

Permalink
rbrunner7 review round 4: writeWatchOnlyWallet; remove QUESTIONs
Browse files Browse the repository at this point in the history
  • Loading branch information
SNeedlewoods committed Sep 27, 2024
1 parent ea8d9e5 commit 6c0f010
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/wallet/api/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3028,13 +3028,13 @@ void WalletImpl::rewriteWalletFile(const std::string &wallet_name, const std::st
}
}
//-------------------------------------------------------------------------------------------------------------------
void WalletImpl::writeWatchOnlyWallet(const std::string &wallet_name, const std::string &password, std::string &new_keys_file_name)
void WalletImpl::writeWatchOnlyWallet(const std::string &password, std::string &new_keys_file_name)
{
clearStatus();

try
{
m_wallet->write_watch_only_wallet(wallet_name, epee::wipeable_string(password.data(), password.size()), new_keys_file_name);
m_wallet->write_watch_only_wallet(m_wallet->get_wallet_file(), epee::wipeable_string(password.data(), password.size()), new_keys_file_name);
}
catch (const std::exception &e)
{
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/api/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class WalletImpl : public Wallet
void createOneOffSubaddress(std::uint32_t account_index, std::uint32_t address_index) override;
WalletState getWalletState() const override;
void rewriteWalletFile(const std::string &wallet_name, const std::string &password) override;
void writeWatchOnlyWallet(const std::string &wallet_name, const std::string &password, std::string &new_keys_file_name) override;
void writeWatchOnlyWallet(const std::string &password, std::string &new_keys_file_name) override;
void updatePoolState(std::vector<std::tuple<cryptonote::transaction, std::string, bool>> &process_txs, bool refreshed = false, bool try_incremental = false) override;
void processPoolState(const std::vector<std::tuple<cryptonote::transaction, std::string, bool>> &txs) override;
void getEnoteDetails(std::vector<EnoteDetails> enote_details) const override;
Expand Down
12 changes: 3 additions & 9 deletions src/wallet/api/wallet2_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ struct EnoteDetails
std::uint64_t m_spent_height;
// key image
std::string m_key_image;
// QUESTION : Is this comment correct? (This is the `rct::key m_mask` from wallet2::transfer_details)
// x, blinding factor in amount commitment C = x G + a H
std::string m_mask;
// a
Expand Down Expand Up @@ -368,8 +367,6 @@ struct SubaddressAccountRow {
std::string m_balance;
std::string m_unlockedBalance;
public:
// QUESTION : afaik this is unused, can we remove it?
std::string extra;
std::string getAddress() const {return m_address;}
std::string getLabel() const {return m_label;}
std::string getBalance() const {return m_balance;}
Expand Down Expand Up @@ -1166,7 +1163,6 @@ struct Wallet
virtual void setOffline(bool offline) = 0;
virtual bool isOffline() const = 0;

// QUESTION : Removing these three functions should be done in a separate PR?
//! blackballs a set of outputs
virtual bool blackballOutputs(const std::vector<std::string> &outputs, bool add) = 0;

Expand Down Expand Up @@ -1222,9 +1218,9 @@ struct Wallet
virtual uint64_t getBytesSent() = 0;

/**
* brief: getMultisigSeed - get mnemonic seed phrase for multisig wallet
* brief: getMultisigSeed - get seed for multisig wallet
* param: seed_offset - passphrase
* return: mnemonic seed phrase if succeeded, else empty string
* return: seed if succeeded, else empty string
* note: sets status error on fail
*/
virtual std::string getMultisigSeed(const std::string &seed_offset) const = 0;
Expand Down Expand Up @@ -1278,15 +1274,13 @@ struct Wallet
* note: sets status error on fail
*/
virtual void rewriteWalletFile(const std::string &wallet_name, const std::string &password) = 0;
// QUESTION : Should we change this function from the current behavior in wallet2, so `wallet_name` is just the name of the new wallet instead of changing the `m_wallet_file` for the current wallet?
/**
* brief: writeWatchOnlyWallet - create a new watch-only wallet file with view keys from current wallet
* param: wallet_name - name of the current wallet file
* param: password - password for new watch-only wallet
* outparam: new_keys_file_name - wallet_name + "-watchonly.keys"
* note: sets status error on fail
*/
virtual void writeWatchOnlyWallet(const std::string &wallet_name, const std::string &password, std::string &new_keys_file_name) = 0;
virtual void writeWatchOnlyWallet(const std::string &password, std::string &new_keys_file_name) = 0;
/**
* brief: updatePoolState -
* outparam: process_txs - [ [tx, tx_id, double_spend_seen], ... ]
Expand Down

0 comments on commit 6c0f010

Please sign in to comment.