This commit is contained in:
JoelKatz
2011-12-13 12:18:10 -08:00
parent 263fe6f515
commit c01707b0f4
2 changed files with 15 additions and 3 deletions

View File

@@ -10,7 +10,13 @@ CKey::pointer PubKeyCache::locate(const uint160& id)
{ // is it in cache
boost::mutex::scoped_lock sl(mLock);
CKey::pointer ret=mCache[id];
if(ret) return ret;
if(ret)
{
#ifdef DEBUG
std::cerr << "PubKey found in cache (locate)" << std::endl;
#endif
return ret;
}
}
std::string sql="SELECT * from PubKeys WHERE ID='";
@@ -49,7 +55,13 @@ CKey::pointer PubKeyCache::store(const uint160& id, CKey::pointer key)
{
boost::mutex::scoped_lock sl(mLock);
CKey::pointer cached(mCache[id]);
if(cached) return cached;
if(cached)
{
#ifdef DEBUG
std::cerr << "PubKey found in cache (store)" << std::endl;
#endif
return cached;
}
mCache[id]=key;
}
std::string sql="INSERT INTO PubKeys (ID, PubKey) VALUES ('";

View File

@@ -12,7 +12,7 @@ class PubKeyCache
{
private:
boost::mutex mLock;
std::map<uint160,CKey::pointer> mCache;
std::map<uint160, CKey::pointer> mCache;
public:
PubKeyCache() { ; }