当前位置: 首页>>代码示例>>Java>>正文


Java BloomFilter.insert方法代码示例

本文整理汇总了Java中org.bitcoinj.core.BloomFilter.insert方法的典型用法代码示例。如果您正苦于以下问题:Java BloomFilter.insert方法的具体用法?Java BloomFilter.insert怎么用?Java BloomFilter.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bitcoinj.core.BloomFilter的用法示例。


在下文中一共展示了BloomFilter.insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBloomFilter

import org.bitcoinj.core.BloomFilter; //导入方法依赖的package包/类
/**
 * <p>Gets a bloom filter that contains all of the public keys from this wallet, and which will provide the given
 * false-positive rate if it has size elements. Keep in mind that you will get 2 elements in the bloom filter for
 * each key in the wallet, for the public key and the hash of the public key (address form).</p>
 * 
 * <p>This is used to generate a BloomFilter which can be {@link BloomFilter#merge(BloomFilter)}d with another.
 * It could also be used if you have a specific target for the filter's size.</p>
 * 
 * <p>See the docs for {@link BloomFilter#BloomFilter(int, double, long, org.bitcoinj.core.BloomFilter.BloomUpdate)} for a brief explanation of anonymity when using bloom
 * filters.</p>
 */
@Override @GuardedBy("keyChainGroupLock")
public BloomFilter getBloomFilter(int size, double falsePositiveRate, long nTweak) {
    beginBloomFilterCalculation();
    try {
        BloomFilter filter = keyChainGroup.getBloomFilter(size, falsePositiveRate, nTweak);
        for (Script script : watchedScripts) {
            for (ScriptChunk chunk : script.getChunks()) {
                // Only add long (at least 64 bit) data to the bloom filter.
                // If any long constants become popular in scripts, we will need logic
                // here to exclude them.
                if (!chunk.isOpCode() && chunk.data.length >= MINIMUM_BLOOM_DATA_LENGTH) {
                    filter.insert(chunk.data);
                }
            }
        }
        for (TransactionOutPoint point : bloomOutPoints)
            filter.insert(point.unsafeBitcoinSerialize());
        return filter;
    } finally {
        endBloomFilterCalculation();
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:34,代码来源:Wallet.java

示例2: getBloomFilter

import org.bitcoinj.core.BloomFilter; //导入方法依赖的package包/类
/**
 * <p>Gets a bloom filter that contains all of the public keys from this wallet, and which will provide the given
 * false-positive rate if it has size elements. Keep in mind that you will get 2 elements in the bloom filter for
 * each key in the wallet, for the public key and the hash of the public key (address form).</p>
 * 
 * <p>This is used to generate a BloomFilter which can be {@link BloomFilter#merge(BloomFilter)}d with another.
 * It could also be used if you have a specific target for the filter's size.</p>
 * 
 * <p>See the docs for {@link BloomFilter(int, double)} for a brief explanation of anonymity when using bloom
 * filters.</p>
 */
@Override @GuardedBy("keyChainGroupLock")
public BloomFilter getBloomFilter(int size, double falsePositiveRate, long nTweak) {
    beginBloomFilterCalculation();
    try {
        BloomFilter filter = keyChainGroup.getBloomFilter(size, falsePositiveRate, nTweak);
        for (Script script : watchedScripts) {
            for (ScriptChunk chunk : script.getChunks()) {
                // Only add long (at least 64 bit) data to the bloom filter.
                // If any long constants become popular in scripts, we will need logic
                // here to exclude them.
                if (!chunk.isOpCode() && chunk.data.length >= MINIMUM_BLOOM_DATA_LENGTH) {
                    filter.insert(chunk.data);
                }
            }
        }
        for (TransactionOutPoint point : bloomOutPoints)
            filter.insert(point.unsafeBitcoinSerialize());
        return filter;
    } finally {
        endBloomFilterCalculation();
    }
}
 
开发者ID:Grant-Redmond,项目名称:cryptwallet,代码行数:34,代码来源:Wallet.java

示例3: getFilter

import org.bitcoinj.core.BloomFilter; //导入方法依赖的package包/类
@Override
public BloomFilter getFilter(int size, double falsePositiveRate, long tweak) {
    lock.lock();
    try {
        BloomFilter filter = new BloomFilter(size, falsePositiveRate, tweak);
        for (ECKey key : hashToKeys.values())
            filter.insert(key);
        return filter;
    } finally {
        lock.unlock();
    }
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:13,代码来源:BasicKeyChain.java


注:本文中的org.bitcoinj.core.BloomFilter.insert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。