Skip to content

Commit e8a3305

Browse files
committed
gui: refactor, do not check encryption by calling 'getNewDestination' twice
1 parent 6602231 commit e8a3305

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

src/qt/addresstablemodel.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -369,21 +369,18 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
369369
else if(type == Receive)
370370
{
371371
// Generate a new address to associate with given label
372-
auto op_dest = walletModel->wallet().getNewDestination(address_type, strLabel);
373-
if (!op_dest) {
374-
WalletModel::UnlockContext ctx(walletModel->requestUnlock());
375-
if (!ctx.isValid()) {
376-
// Unlock wallet failed or was cancelled
377-
editStatus = WALLET_UNLOCK_FAILURE;
378-
return QString();
379-
}
380-
op_dest.Update(walletModel->wallet().getNewDestination(address_type, strLabel));
381-
if (!op_dest) {
382-
editStatus = KEY_GENERATION_FAILURE;
383-
return QString();
384-
}
372+
WalletModel::UnlockContext ctx(walletModel->requestUnlock());
373+
if (!ctx.isValid()) {
374+
// Unlock wallet failed or was cancelled
375+
editStatus = WALLET_UNLOCK_FAILURE;
376+
return QString();
377+
}
378+
if (auto op_dest = walletModel->wallet().getNewDestination(address_type, strLabel)) {
379+
strAddress = EncodeDestination(*op_dest);
380+
} else {
381+
editStatus = KEY_GENERATION_FAILURE;
382+
return QString();
385383
}
386-
strAddress = EncodeDestination(*op_dest);
387384
}
388385
else
389386
{

0 commit comments

Comments
 (0)