mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
[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.
This commit is contained in:
parent
b60012f2b6
commit
20469d83dd
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user