| 3494 | } |
| 3495 | |
| 3496 | static int64_t GetOldestKeyTimeInPool(const std::set<int64_t>& setKeyPool, WalletBatch& batch) { |
| 3497 | if (setKeyPool.empty()) { |
| 3498 | return GetTime(); |
| 3499 | } |
| 3500 | |
| 3501 | CKeyPool keypool; |
| 3502 | int64_t nIndex = *(setKeyPool.begin()); |
| 3503 | if (!batch.ReadPool(nIndex, keypool)) { |
| 3504 | throw std::runtime_error(std::string(__func__) + ": read oldest key in keypool failed"); |
| 3505 | } |
| 3506 | assert(keypool.vchPubKey.IsValid()); |
| 3507 | return keypool.nTime; |
| 3508 | } |
| 3509 | |
| 3510 | int64_t CWallet::GetOldestKeyPoolTime() |
| 3511 | { |