Merge pull request #1560

46550c0b Wallet API: add rescanSpent() (Jaquee)
This commit is contained in:
Riccardo Spagni 2017-01-15 14:44:49 -05:00
commit 935f50471c
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
3 changed files with 24 additions and 1 deletions

View File

@ -1217,6 +1217,24 @@ bool WalletImpl::parse_uri(const std::string &uri, std::string &address, std::st
return m_wallet->parse_uri(uri, address, payment_id, amount, tx_description, recipient_name, unknown_parameters, error); return m_wallet->parse_uri(uri, address, payment_id, amount, tx_description, recipient_name, unknown_parameters, error);
} }
bool WalletImpl::rescanSpent()
{
clearStatus();
if (!trustedDaemon()) {
m_status = Status_Error;
m_errorString = tr("Rescan spent can only be used with a trusted daemon");
return false;
}
try {
m_wallet->rescan_spent();
} catch (const std::exception &e) {
LOG_ERROR(__FUNCTION__ << " error: " << e.what());
m_status = Status_Error;
m_errorString = e.what();
return false;
}
return true;
}
} // namespace } // namespace
namespace Bitmonero = Monero; namespace Bitmonero = Monero;

View File

@ -93,7 +93,7 @@ public:
void setRefreshFromBlockHeight(uint64_t refresh_from_block_height); void setRefreshFromBlockHeight(uint64_t refresh_from_block_height);
void setRecoveringFromSeed(bool recoveringFromSeed); void setRecoveringFromSeed(bool recoveringFromSeed);
bool watchOnly() const; bool watchOnly() const;
bool rescanSpent();
PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id, PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id,

View File

@ -558,6 +558,11 @@ struct Wallet
virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const = 0; virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const = 0;
virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error) = 0; virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector<std::string> &unknown_parameters, std::string &error) = 0;
/*
* \brief rescanSpent - Rescan spent outputs - Can only be used with trusted daemon
* \return true on success
*/
virtual bool rescanSpent() = 0;
}; };
/** /**