| 2362 | } |
| 2363 | |
| 2364 | DBErrors CWallet::ZapSelectTx(std::vector<uint256>& vHashIn, std::vector<uint256>& vHashOut) |
| 2365 | { |
| 2366 | AssertLockHeld(cs_wallet); |
| 2367 | DBErrors nZapSelectTxRet = WalletBatch(GetDatabase()).ZapSelectTx(vHashIn, vHashOut); |
| 2368 | for (const uint256& hash : vHashOut) { |
| 2369 | const auto& it = mapWallet.find(hash); |
| 2370 | wtxOrdered.erase(it->second.m_it_wtxOrdered); |
| 2371 | for (const auto& txin : it->second.tx->vin) |
| 2372 | mapTxSpends.erase(txin.prevout); |
| 2373 | mapWallet.erase(it); |
| 2374 | NotifyTransactionChanged(hash, CT_DELETED); |
| 2375 | } |
| 2376 | |
| 2377 | if (nZapSelectTxRet == DBErrors::NEED_REWRITE) |
| 2378 | { |
| 2379 | if (GetDatabase().Rewrite("\x04pool")) |
| 2380 | { |
| 2381 | for (const auto& spk_man_pair : m_spk_managers) { |
| 2382 | spk_man_pair.second->RewriteDB(); |
| 2383 | } |
| 2384 | } |
| 2385 | } |
| 2386 | |
| 2387 | if (nZapSelectTxRet != DBErrors::LOAD_OK) |
| 2388 | return nZapSelectTxRet; |
| 2389 | |
| 2390 | MarkDirty(); |
| 2391 | |
| 2392 | return DBErrors::LOAD_OK; |
| 2393 | } |
| 2394 | |
| 2395 | bool CWallet::SetAddressBookWithDB(WalletBatch& batch, const CTxDestination& address, const std::string& strName, const std::string& strPurpose) |
| 2396 | { |