MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / requestUnlock

Method requestUnlock

src/qt/walletmodel.cpp:428–447  ·  view source on GitHub ↗

WalletModel::UnlockContext implementation

Source from the content-addressed store, hash-verified

426
427// WalletModel::UnlockContext implementation
428WalletModel::UnlockContext WalletModel::requestUnlock()
429{
430 // Bugs in earlier versions may have resulted in wallets with private keys disabled to become "encrypted"
431 // (encryption keys are present, but not actually doing anything).
432 // To avoid issues with such wallets, check if the wallet has private keys disabled, and if so, return a context
433 // that indicates the wallet is not encrypted.
434 if (m_wallet->privateKeysDisabled()) {
435 return UnlockContext(this, /*valid=*/true, /*relock=*/false);
436 }
437 bool was_locked = getEncryptionStatus() == Locked;
438 if(was_locked)
439 {
440 // Request UI to unlock wallet
441 Q_EMIT requireUnlock();
442 }
443 // If wallet is still locked, unlock was failed or cancelled, mark context as invalid
444 bool valid = getEncryptionStatus() != Locked;
445
446 return UnlockContext(this, valid, was_locked);
447}
448
449WalletModel::UnlockContext::UnlockContext(WalletModel *_wallet, bool _valid, bool _relock):
450 wallet(_wallet),

Callers 4

signTransactionMethod · 0.80
PrepareSendTextMethod · 0.80
addRowMethod · 0.80

Calls 2

UnlockContextClass · 0.85
privateKeysDisabledMethod · 0.80

Tested by

no test coverage detected