DiosDelRayo 2024-11-21 13:26:39 -06:00
parent bc76da9a93
commit c399de283f
No known key found for this signature in database
GPG Key ID: 93DD9A1E96E458E4
3 changed files with 26 additions and 25 deletions

View File

@ -1183,7 +1183,7 @@ bool WalletImpl::submitTransactionFromString(const string &data) {
bool r = m_wallet->parse_tx_from_str(data, transaction->m_pending_tx, NULL);
if (!r) {
setStatus(Status_Ok, tr("Failed to load transaction from string"));
setStatusError(Status_Ok, tr("Failed to load transaction from string"));
return false;
}
@ -1197,24 +1197,24 @@ bool WalletImpl::submitTransactionFromString(const string &data) {
std::string WalletImpl::exportKeyImagesAsString(bool all)
{
if (m_wallet->watch_only())
{
setStatusError(tr("Wallet is view only"));
return "";
}
if (checkBackgroundSync("cannot export key images"))
return "";
if (m_wallet->watch_only())
{
setStatusError(tr("Wallet is view only"));
return "";
}
if (checkBackgroundSync("cannot export key images"))
return "";
try
{
try
{
return m_wallet->export_key_images_string(all);
}
catch (const std::exception &e)
{
LOG_ERROR("Error exporting key images: " << e.what());
setStatusError(e.what());
return "";
}
}
catch (const std::exception &e)
{
LOG_ERROR("Error exporting key images: " << e.what());
setStatusError(e.what());
return "";
}
}
bool WalletImpl::exportKeyImages(const string &filename, bool all)
@ -1248,7 +1248,8 @@ bool WalletImpl::importKeyImagesFromString(const std::string &data)
{
if (checkBackgroundSync("cannot import key images"))
return false;
if (!trustedDaemon()) {
if (!trustedDaemon())
{
setStatusError(tr("Key images can only be imported with a trusted daemon"));
return false;
}

View File

@ -166,9 +166,9 @@ public:
std::set<uint32_t> subaddr_indices = {}) override;
virtual PendingTransaction * createSweepUnmixableTransaction() override;
bool submitTransaction(const std::string &fileName) override;
bool submitTransactionFromString(const std::string &fileName) override;
bool submitTransactionFromString(const std::string &data) override;
virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) override;
virtual UnsignedTransaction * loadUnsignedTxFromString(const std::string &unsigned_filename) override;
virtual UnsignedTransaction * loadUnsignedTxFromString(const std::string &data) override;
std::string exportKeyImagesAsString(bool all = false) override;
bool exportKeyImages(const std::string &filename, bool all = false) override;
bool importKeyImagesFromString(const std::string &data) override;

View File

@ -164,8 +164,8 @@ struct UnsignedTransaction
*/
virtual bool sign(const std::string &signedFileName) = 0;
/*!
* @brief sign - Sign txs and return as string
* return - true on success
* @brief signAsString - Sign txs and return as string
* return - signed tx as string on success
*/
virtual std::string signAsString() = 0;
};
@ -907,7 +907,7 @@ struct Wallet
* \return - UnsignedTransaction object. caller is responsible to check UnsignedTransaction::status()
* after object returned
*/
virtual UnsignedTransaction * loadUnsignedTxFromString(const std::string &unsigned_filename) = 0;
virtual UnsignedTransaction * loadUnsignedTxFromString(const std::string &data) = 0;
/*!
* \brief submitTransaction - submits transaction in signed tx file
@ -916,10 +916,10 @@ struct Wallet
virtual bool submitTransaction(const std::string &fileName) = 0;
/*!
* \brief submitTransactionFromString - submits transaction in signed tx file
* \brief submitTransactionFromString - submits transaction provided as string
* \return - true on success
*/
virtual bool submitTransactionFromString(const std::string &fileName) = 0;
virtual bool submitTransactionFromString(const std::string &data) = 0;
/*!