Skip to content

Commit

Permalink
lower granularity of locks in signature cache
Browse files Browse the repository at this point in the history
  • Loading branch information
tamasblummer committed Nov 13, 2012
1 parent efe2de3 commit b750ef9
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/com/bitsofproof/supernode/core/Script.java
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,19 @@ else if ( (hashType & 0x1f) == SIGHASH_SINGLE )
String cacheKey = c.toString ();
synchronized ( validSignatureCache )
{
return validSignatureCache.contains (cacheKey) || ECKeyPair.verify (hash, sig, pubkey) && validSignatureCache.add (cacheKey);
if ( validSignatureCache.contains (cacheKey) )
{
return true;
}
}
if ( ECKeyPair.verify (hash, sig, pubkey) )
{
synchronized ( validSignatureCache )
{
validSignatureCache.add (cacheKey);
}
return true;
}
return false;
}
}

0 comments on commit b750ef9

Please sign in to comment.