mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-03-13 06:01:45 +00:00
Fixed namespace creation crash when there is insufficient fund.
This commit is contained in:
parent
30056ced34
commit
a13b6aa276
@ -457,6 +457,9 @@ int KevaDialog::createNamespace(std::string displayName, std::string& namespaceI
|
||||
case WalletModel::NamespaceTooLong:
|
||||
msg = tr("Namespace too long \"%1\"").arg(QString::fromStdString(displayName));
|
||||
break;
|
||||
case WalletModel::InsufficientFund:
|
||||
msg = tr("Insufficient funds");
|
||||
break;
|
||||
default:
|
||||
msg = tr("Unknown error.");
|
||||
}
|
||||
|
@ -1181,7 +1181,12 @@
|
||||
<context>
|
||||
<name>KevaBookmarksDialog</name>
|
||||
<message>
|
||||
<location filename="../kevabookmarksdialog.cpp" line="+23"/>
|
||||
<location filename="../kevabookmarksdialog.cpp" line="+22"/>
|
||||
<source>&Show</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+2"/>
|
||||
<source>&Edit</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1215,7 +1220,7 @@
|
||||
<context>
|
||||
<name>KevaDialog</name>
|
||||
<message>
|
||||
<location filename="../forms/kevadialog.ui" line="+267"/>
|
||||
<location filename="../forms/kevadialog.ui" line="+271"/>
|
||||
<source>Show the selected request (does the same as double clicking an entry)</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1226,8 +1231,8 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-234"/>
|
||||
<location line="+44"/>
|
||||
<location line="-238"/>
|
||||
<location line="+48"/>
|
||||
<source>The namespace ID with a prefix "N".</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -1327,7 +1332,7 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+259"/>
|
||||
<location line="+262"/>
|
||||
<source>Warning</source>
|
||||
<translation type="unfinished">Warning</translation>
|
||||
</message>
|
||||
@ -1348,23 +1353,28 @@
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<location line="+122"/>
|
||||
<location line="+125"/>
|
||||
<location line="+28"/>
|
||||
<source>Unknown error.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-148"/>
|
||||
<location line="+122"/>
|
||||
<location line="-151"/>
|
||||
<location line="+125"/>
|
||||
<location line="+28"/>
|
||||
<source>Error</source>
|
||||
<translation type="unfinished">Error</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="-33"/>
|
||||
<location line="-36"/>
|
||||
<source>Namespace too long "%1"</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+3"/>
|
||||
<source>Insufficient funds</source>
|
||||
<translation type="unfinished">Insufficient funds</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+22"/>
|
||||
<source>Cannot add key-value. Make sure you own this namespace.</source>
|
||||
@ -1461,7 +1471,7 @@
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location line="+88"/>
|
||||
<location line="+86"/>
|
||||
<source>Requested</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@ -4196,7 +4206,7 @@
|
||||
<context>
|
||||
<name>WalletModel</name>
|
||||
<message>
|
||||
<location filename="../walletmodel.cpp" line="+304"/>
|
||||
<location filename="../walletmodel.cpp" line="+306"/>
|
||||
<source>Send Coins</source>
|
||||
<translation type="unfinished">Send Coins</translation>
|
||||
</message>
|
||||
|
@ -1065,6 +1065,10 @@
|
||||
<source>Namespace too long "%1"</source>
|
||||
<translation><numerusform>命名空间太长: "%1"</numerusform></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Insufficient funds</source>
|
||||
<translation>存款不足</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Cannot add key-value. Make sure you own this namespace.</source>
|
||||
<translation>无法添加键值。确保您拥有此名称空间。</translation>
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include <base58.h>
|
||||
#include <chain.h>
|
||||
#include <univalue.h>
|
||||
#include <rpc/protocol.h>
|
||||
#include <keystore.h>
|
||||
#include <keva/common.h>
|
||||
#include <keva/main.h>
|
||||
@ -915,8 +917,17 @@ int WalletModel::createNamespace(std::string displayNameStr, std::string& namesp
|
||||
CCoinControl coinControl;
|
||||
CWalletTx wtx;
|
||||
valtype kevaNamespace;
|
||||
SendMoneyToScript(wallet, newScript, nullptr, kevaNamespace,
|
||||
KEVA_LOCKED_AMOUNT, false, wtx, coinControl);
|
||||
try {
|
||||
SendMoneyToScript(wallet, newScript, nullptr, kevaNamespace,
|
||||
KEVA_LOCKED_AMOUNT, false, wtx, coinControl);
|
||||
} catch (const UniValue& objError) {
|
||||
UniValue code = objError["code"];
|
||||
if (code.get_int() == RPC_WALLET_INSUFFICIENT_FUNDS) {
|
||||
return WalletModel::InsufficientFund;
|
||||
}
|
||||
return WalletModel::CannotUpdate;
|
||||
}
|
||||
|
||||
keyName.KeepKey();
|
||||
|
||||
namespaceId = EncodeBase58Check(kevaNamespace);
|
||||
|
@ -131,6 +131,7 @@ public:
|
||||
KeyNotFound,
|
||||
ValueTooLong,
|
||||
CannotUpdate,
|
||||
InsufficientFund,
|
||||
};
|
||||
|
||||
enum EncryptionStatus
|
||||
|
Loading…
x
Reference in New Issue
Block a user