wallet: refactor GetNewDestination, use BResult

This commit is contained in:
furszy committed 2022-07-08 11:18:35 -03:00
1 parent 22351725bc
commit 111ea3ab71
13 files changed
+72 -86

No files matched your search

+6 -8
View File
@@ -370,23 +370,21 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
else if(type == Receive)
{
// Generate a new address to associate with given label
CTxDestination dest;
if(!walletModel->wallet().getNewDestination(address_type, strLabel, dest))
{
auto op_dest = walletModel->wallet().getNewDestination(address_type, strLabel);
if (!op_dest) {
WalletModel::UnlockContext ctx(walletModel->requestUnlock());
if(!ctx.isValid())
{
if (!ctx.isValid()) {
// Unlock wallet failed or was cancelled
editStatus = WALLET_UNLOCK_FAILURE;
return QString();
}
if(!walletModel->wallet().getNewDestination(address_type, strLabel, dest))
{
op_dest = walletModel->wallet().getNewDestination(address_type, strLabel);
if (!op_dest) {
editStatus = KEY_GENERATION_FAILURE;
return QString();
}
}
strAddress = EncodeDestination(dest);
strAddress = EncodeDestination(op_dest.GetObj());
}
else
{