aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2013-08-15 21:53:21 -0700
committerGregory Maxwell <greg@xiph.org>2013-08-23 12:01:57 -0700
commit20469d83dd2fd7d8efacf94f017b926be7c92e63 (patch)
tree8720b5fe9d1ae1ea9c2b67886e37bc9c7cd9f166 /src
parentb60012f2b6770105557db2af40dc34947e884330 (diff)
[QT] Don't ask for a passphrase to getnewaddress.
With an encrypted wallet the GUI was prompting for a passphrase every time the user requested a new address. This is unnecessary, increases the exposure to keyboard sniffers, and discourages using fresh addresses for every transaction. Instead only prompt for a passphrase when the keypool runs out, also call the new address function with the flag that prevents reuse. Thanks to AlexNagy on IRC for pointing this out and who wouldn't take any lip from a curmudgeonly developer and insisted on what he knew to be true.
Diffstat (limited to 'src')
-rw-r--r--src/qt/addresstablemodel.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp
index dcc70222cc..d4a7a92876 100644
--- a/src/qt/addresstablemodel.cpp
+++ b/src/qt/addresstablemodel.cpp
@@ -355,18 +355,21 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
else if(type == Receive)
{
// Generate a new address to associate with given label
- WalletModel::UnlockContext ctx(walletModel->requestUnlock());
- if(!ctx.isValid())
- {
- // Unlock wallet failed or was cancelled
- editStatus = WALLET_UNLOCK_FAILURE;
- return QString();
- }
CPubKey newKey;
- if(!wallet->GetKeyFromPool(newKey, true))
+ if(!wallet->GetKeyFromPool(newKey, false))
{
- editStatus = KEY_GENERATION_FAILURE;
- return QString();
+ WalletModel::UnlockContext ctx(walletModel->requestUnlock());
+ if(!ctx.isValid())
+ {
+ // Unlock wallet failed or was cancelled
+ editStatus = WALLET_UNLOCK_FAILURE;
+ return QString();
+ }
+ if(!wallet->GetKeyFromPool(newKey, false))
+ {
+ editStatus = KEY_GENERATION_FAILURE;
+ return QString();
+ }
}
strAddress = CBitcoinAddress(newKey.GetID()).ToString();
}