wallet: return and display signer error

Both RPC and GUI now render a useful error message instead of (silently) failing.

Replace bool with util::Result<void> to clarify that this either succeeds or returns an error message.
This commit is contained in:
Sjors Provoost
2024-02-13 13:25:59 +01:00
parent dc55531087
commit 4357158c47
12 changed files with 41 additions and 23 deletions

View File

@@ -569,16 +569,17 @@ bool WalletModel::bumpFee(uint256 hash, uint256& new_hash)
return true;
}
bool WalletModel::displayAddress(std::string sAddress) const
void WalletModel::displayAddress(std::string sAddress) const
{
CTxDestination dest = DecodeDestination(sAddress);
bool res = false;
try {
res = m_wallet->displayAddress(dest);
util::Result<void> result = m_wallet->displayAddress(dest);
if (!result) {
QMessageBox::warning(nullptr, tr("Signer error"), QString::fromStdString(util::ErrorString(result).translated));
}
} catch (const std::runtime_error& e) {
QMessageBox::critical(nullptr, tr("Can't display address"), e.what());
}
return res;
}
bool WalletModel::isWalletEnabled()