mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-02-07 14:54:15 +00:00
PeerFilterProvider methods are called with the lock already held, so just assert on that instead of locking again.
This commit is contained in:
parent
f6b2fa5a2b
commit
e888807dfd
@ -3648,6 +3648,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int getBloomFilterElementCount() {
|
public int getBloomFilterElementCount() {
|
||||||
|
checkState(lock.isHeldByCurrentThread());
|
||||||
int size = keychain.getBloomFilterElementCount();
|
int size = keychain.getBloomFilterElementCount();
|
||||||
for (Transaction tx : getTransactions(false)) {
|
for (Transaction tx : getTransactions(false)) {
|
||||||
for (TransactionOutput out : tx.getOutputs()) {
|
for (TransactionOutput out : tx.getOutputs()) {
|
||||||
@ -3674,6 +3675,7 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean isRequiringUpdateAllBloomFilter() {
|
public boolean isRequiringUpdateAllBloomFilter() {
|
||||||
|
checkState(lock.isHeldByCurrentThread());
|
||||||
return !watchedScripts.isEmpty();
|
return !watchedScripts.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3698,23 +3700,17 @@ public class Wallet extends BaseTaggableObject implements Serializable, BlockCha
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public BloomFilter getBloomFilter(int size, double falsePositiveRate, long nTweak) {
|
public BloomFilter getBloomFilter(int size, double falsePositiveRate, long nTweak) {
|
||||||
BloomFilter filter;
|
checkState(lock.isHeldByCurrentThread());
|
||||||
lock.lock();
|
BloomFilter filter = keychain.getBloomFilter(size, falsePositiveRate, nTweak);
|
||||||
try {
|
for (Script script : watchedScripts) {
|
||||||
filter = keychain.getBloomFilter(size, falsePositiveRate, nTweak);
|
for (ScriptChunk chunk : script.getChunks()) {
|
||||||
|
// Only add long (at least 64 bit) data to the bloom filter.
|
||||||
for (Script script : watchedScripts) {
|
// If any long constants become popular in scripts, we will need logic
|
||||||
for (ScriptChunk chunk : script.getChunks()) {
|
// here to exclude them.
|
||||||
// Only add long (at least 64 bit) data to the bloom filter.
|
if (!chunk.isOpCode() && chunk.data.length >= MINIMUM_BLOOM_DATA_LENGTH) {
|
||||||
// If any long constants become popular in scripts, we will need logic
|
filter.insert(chunk.data);
|
||||||
// here to exclude them.
|
|
||||||
if (!chunk.isOpCode() && chunk.data.length >= MINIMUM_BLOOM_DATA_LENGTH) {
|
|
||||||
filter.insert(chunk.data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
lock.unlock();
|
|
||||||
}
|
}
|
||||||
for (Transaction tx : getTransactions(false)) {
|
for (Transaction tx : getTransactions(false)) {
|
||||||
for (int i = 0; i < tx.getOutputs().size(); i++) {
|
for (int i = 0; i < tx.getOutputs().size(); i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user