@@ -1373,111 +1373,6 @@ bool CWalletDB::WriteMintPoolPair(const uint256& hashMasterSeed, const uint256&
13731373 return Write (std::make_pair (std::string (" mintpool" ), hashPubcoin), std::make_pair (hashMasterSeed, nCount));
13741374}
13751375
1376- void CWalletDB::LoadPrecomputes (std::list<std::pair<uint256, CoinWitnessCacheData> >& itemList, std::map<uint256, std::list<std::pair<uint256, CoinWitnessCacheData> >::iterator>& itemMap)
1377- {
1378-
1379- Dbc* pcursor = GetCursor ();
1380- if (!pcursor)
1381- throw std::runtime_error (std::string (__func__)+" : cannot create DB cursor" );
1382- unsigned int fFlags = DB_SET_RANGE;
1383- for (;;)
1384- {
1385- // Read next record
1386- CDataStream ssKey (SER_DISK, CLIENT_VERSION);
1387- if (fFlags == DB_SET_RANGE)
1388- ssKey << std::make_pair (std::string (" precompute" ), uint256 (0 ));
1389- CDataStream ssValue (SER_DISK, CLIENT_VERSION);
1390- int ret = ReadAtCursor (pcursor, ssKey, ssValue, fFlags );
1391- fFlags = DB_NEXT;
1392- if (ret == DB_NOTFOUND)
1393- break ;
1394- else if (ret != 0 )
1395- {
1396- pcursor->close ();
1397- throw std::runtime_error (std::string (__func__)+" : error scanning precompute DB" );
1398- }
1399-
1400- // Unserialize
1401- std::string strType;
1402- ssKey >> strType;
1403- if (strType != " precompute" )
1404- break ;
1405-
1406- uint256 hash;
1407- ssKey >> hash;
1408-
1409- CoinWitnessCacheData cacheData;
1410- ssValue >> cacheData;
1411-
1412- itemList.push_front (std::make_pair (hash, cacheData));
1413- itemMap.insert (std::make_pair (hash, itemList.begin ()));
1414-
1415- if (itemMap.size () == PRECOMPUTE_LRU_CACHE_SIZE)
1416- break ;
1417- }
1418-
1419- pcursor->close ();
1420- }
1421-
1422- void CWalletDB::LoadPrecomputes (std::set<uint256> setHashes)
1423- {
1424- Dbc* pcursor = GetCursor ();
1425- if (!pcursor)
1426- throw std::runtime_error (std::string (__func__)+" : cannot create DB cursor" );
1427- unsigned int fFlags = DB_SET_RANGE;
1428- for (;;)
1429- {
1430- // Read next record
1431- CDataStream ssKey (SER_DISK, CLIENT_VERSION);
1432- if (fFlags == DB_SET_RANGE)
1433- ssKey << make_pair (std::string (" precompute" ), uint256 (0 ));
1434- CDataStream ssValue (SER_DISK, CLIENT_VERSION);
1435- int ret = ReadAtCursor (pcursor, ssKey, ssValue, fFlags );
1436- fFlags = DB_NEXT;
1437- if (ret == DB_NOTFOUND)
1438- break ;
1439- else if (ret != 0 )
1440- {
1441- pcursor->close ();
1442- throw std::runtime_error (std::string (__func__)+" : error scanning precompute DB" );
1443- }
1444-
1445- // Unserialize
1446- std::string strType;
1447- ssKey >> strType;
1448- if (strType != " precompute" )
1449- break ;
1450-
1451- uint256 hash;
1452- ssKey >> hash;
1453-
1454- setHashes.insert (hash);
1455- }
1456-
1457- pcursor->close ();
1458- }
1459-
1460- void CWalletDB::EraseAllPrecomputes ()
1461- {
1462- std::set<uint256> setHashes;
1463- LoadPrecomputes (setHashes);
1464-
1465- for (auto hash : setHashes)
1466- ErasePrecompute (hash);
1467- }
1468-
1469- bool CWalletDB::WritePrecompute (const uint256& hash, const CoinWitnessCacheData& data)
1470- {
1471- return Write (std::make_pair (std::string (" precompute" ), hash), data);
1472- }
1473- bool CWalletDB::ReadPrecompute (const uint256& hash, CoinWitnessCacheData& data)
1474- {
1475- return Read (std::make_pair (std::string (" precompute" ), hash), data);
1476- }
1477- bool CWalletDB::ErasePrecompute (const uint256& hash)
1478- {
1479- return Erase (std::make_pair (std::string (" precompute" ), hash));
1480- }
14811376
14821377// ! map with hashMasterSeed as the key, paired with vector of hashPubcoins and their count
14831378std::map<uint256, std::vector<std::pair<uint256, uint32_t > > > CWalletDB::MapMintPool ()
0 commit comments