aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/wallet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/api/wallet.cpp')
-rw-r--r--src/wallet/api/wallet.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/wallet/api/wallet.cpp b/src/wallet/api/wallet.cpp
index 50a399e9e..9a9638b40 100644
--- a/src/wallet/api/wallet.cpp
+++ b/src/wallet/api/wallet.cpp
@@ -158,8 +158,13 @@ std::string Wallet::genPaymentId()
bool Wallet::paymentIdValid(const string &paiment_id)
{
- crypto::hash8 pid;
- return tools::wallet2::parse_short_payment_id(paiment_id, pid);
+ crypto::hash8 pid8;
+ if (tools::wallet2::parse_short_payment_id(paiment_id, pid8))
+ return true;
+ crypto::hash pid;
+ if (tools::wallet2::parse_long_payment_id(paiment_id, pid))
+ return true;
+ return false;
}
bool Wallet::addressValid(const std::string &str, bool testnet)
@@ -380,7 +385,7 @@ std::string WalletImpl::integratedAddress(const std::string &payment_id) const
{
crypto::hash8 pid;
if (!tools::wallet2::parse_short_payment_id(payment_id, pid)) {
- pid = crypto::rand<crypto::hash8>();
+ return "";
}
return m_wallet->get_account().get_public_integrated_address_str(pid, m_wallet->testnet());
}
@@ -615,6 +620,15 @@ PendingTransaction *WalletImpl::createTransaction(const string &dst_addr, const
m_status = Status_Error;
std::ostringstream writer;
+ writer << boost::format(tr("not enough money to transfer, available only %s, sent amount %s")) %
+ print_money(e.available()) %
+ print_money(e.tx_amount());
+ m_errorString = writer.str();
+
+ } catch (const tools::error::tx_not_possible& e) {
+ m_status = Status_Error;
+ std::ostringstream writer;
+
writer << boost::format(tr("not enough money to transfer, available only %s, transaction amount %s = %s + %s (fee)")) %
print_money(e.available()) %
print_money(e.tx_amount() + e.fee()) %