| 1388 | } |
| 1389 | |
| 1390 | bool LegacyScriptPubKeyMan::GetKeyFromPool(CPubKey& result, const OutputType type, bool internal) |
| 1391 | { |
| 1392 | assert(type != OutputType::BECH32M); |
| 1393 | if (!CanGetAddresses(internal)) { |
| 1394 | return false; |
| 1395 | } |
| 1396 | |
| 1397 | CKeyPool keypool; |
| 1398 | { |
| 1399 | LOCK(cs_KeyStore); |
| 1400 | int64_t nIndex; |
| 1401 | if (!ReserveKeyFromKeyPool(nIndex, keypool, internal) && !m_storage.IsWalletFlagSet(WALLET_FLAG_DISABLE_PRIVATE_KEYS)) { |
| 1402 | if (m_storage.IsLocked()) return false; |
| 1403 | WalletBatch batch(m_storage.GetDatabase()); |
| 1404 | result = GenerateNewKey(batch, m_hd_chain, internal); |
| 1405 | return true; |
| 1406 | } |
| 1407 | KeepDestination(nIndex, type); |
| 1408 | result = keypool.vchPubKey; |
| 1409 | } |
| 1410 | return true; |
| 1411 | } |
| 1412 | |
| 1413 | bool LegacyScriptPubKeyMan::ReserveKeyFromKeyPool(int64_t& nIndex, CKeyPool& keypool, bool fRequestedInternal) |
| 1414 | { |
nothing calls this directly
no test coverage detected