wallet api: Remove initAsync() and don't start refresh automatically on init
This commit is contained in:
parent
031b060af0
commit
805625b541
3 changed files with 6 additions and 31 deletions
|
@ -515,7 +515,6 @@ bool WalletImpl::recover(const std::string &path, const std::string &seed)
|
||||||
try {
|
try {
|
||||||
m_wallet->set_seed_language(old_language);
|
m_wallet->set_seed_language(old_language);
|
||||||
m_wallet->generate(path, "", recovery_key, true, false);
|
m_wallet->generate(path, "", recovery_key, true, false);
|
||||||
// TODO: wallet->init(daemon_address);
|
|
||||||
|
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
m_status = Status_Critical;
|
m_status = Status_Critical;
|
||||||
|
@ -646,19 +645,7 @@ string WalletImpl::keysFilename() const
|
||||||
bool WalletImpl::init(const std::string &daemon_address, uint64_t upper_transaction_size_limit)
|
bool WalletImpl::init(const std::string &daemon_address, uint64_t upper_transaction_size_limit)
|
||||||
{
|
{
|
||||||
clearStatus();
|
clearStatus();
|
||||||
if (!doInit(daemon_address, upper_transaction_size_limit))
|
return doInit(daemon_address, upper_transaction_size_limit);
|
||||||
return false;
|
|
||||||
bool result = this->refresh();
|
|
||||||
// enabling background refresh thread
|
|
||||||
startRefresh();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void WalletImpl::initAsync(const string &daemon_address, uint64_t upper_transaction_size_limit)
|
|
||||||
{
|
|
||||||
clearStatus();
|
|
||||||
doInit(daemon_address, upper_transaction_size_limit);
|
|
||||||
startRefresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WalletImpl::setRefreshFromBlockHeight(uint64_t refresh_from_block_height)
|
void WalletImpl::setRefreshFromBlockHeight(uint64_t refresh_from_block_height)
|
||||||
|
|
|
@ -78,8 +78,7 @@ public:
|
||||||
bool store(const std::string &path);
|
bool store(const std::string &path);
|
||||||
std::string filename() const;
|
std::string filename() const;
|
||||||
std::string keysFilename() const;
|
std::string keysFilename() const;
|
||||||
bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit);
|
bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0);
|
||||||
void initAsync(const std::string &daemon_address, uint64_t upper_transaction_size_limit);
|
|
||||||
bool connectToDaemon();
|
bool connectToDaemon();
|
||||||
ConnectionStatus connected() const;
|
ConnectionStatus connected() const;
|
||||||
void setTrustedDaemon(bool arg);
|
void setTrustedDaemon(bool arg);
|
||||||
|
@ -135,7 +134,6 @@ private:
|
||||||
bool isNewWallet() const;
|
bool isNewWallet() const;
|
||||||
bool doInit(const std::string &daemon_address, uint64_t upper_transaction_size_limit);
|
bool doInit(const std::string &daemon_address, uint64_t upper_transaction_size_limit);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class PendingTransactionImpl;
|
friend class PendingTransactionImpl;
|
||||||
friend class UnsignedTransactionImpl;
|
friend class UnsignedTransactionImpl;
|
||||||
|
|
|
@ -332,26 +332,16 @@ struct Wallet
|
||||||
*/
|
*/
|
||||||
virtual std::string keysFilename() const = 0;
|
virtual std::string keysFilename() const = 0;
|
||||||
/*!
|
/*!
|
||||||
* \brief init - initializes wallet with daemon connection params. implicitly connects to the daemon
|
* \brief init - initializes wallet with daemon connection params.
|
||||||
* and refreshes the wallet. "refreshed" callback will be invoked. if daemon_address is
|
* if daemon_address is local address, "trusted daemon" will be set to true forcibly
|
||||||
* local address, "trusted daemon" will be set to true forcibly
|
* startRefresh() should be called when wallet is initialized.
|
||||||
*
|
*
|
||||||
* \param daemon_address - daemon address in "hostname:port" format
|
* \param daemon_address - daemon address in "hostname:port" format
|
||||||
* \param upper_transaction_size_limit
|
* \param upper_transaction_size_limit
|
||||||
* \return - true if initialized and refreshed successfully
|
* \return - true on success
|
||||||
*/
|
*/
|
||||||
virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit) = 0;
|
virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit) = 0;
|
||||||
|
|
||||||
/*!
|
|
||||||
* \brief init - initalizes wallet asynchronously. logic is the same as "init" but returns immediately.
|
|
||||||
* "refreshed" callback will be invoked.
|
|
||||||
*
|
|
||||||
* \param daemon_address - daemon address in "hostname:port" format
|
|
||||||
* \param upper_transaction_size_limit
|
|
||||||
* \return - true if initialized and refreshed successfully
|
|
||||||
*/
|
|
||||||
virtual void initAsync(const std::string &daemon_address, uint64_t upper_transaction_size_limit) = 0;
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief createWatchOnly - Creates a watch only wallet
|
* \brief createWatchOnly - Creates a watch only wallet
|
||||||
* \param path - where to store the wallet
|
* \param path - where to store the wallet
|
||||||
|
|
Loading…
Reference in a new issue