• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BloomFilter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



BloomFilter类属于org.bitcoinj.core包,在下文中一共展示了BloomFilter类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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 {
        checkArgument(size >= numBloomFilterEntries());
        maybeLookAhead();
        return basicKeyChain.getFilter(size, falsePositiveRate, tweak);
    } finally {
        lock.unlock();
    }

}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:13,代码来源:DeterministicKeyChain.java


示例4: 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


示例5: bloom

import org.bitcoinj.core.BloomFilter; //导入依赖的package包/类
@Test
public void bloom() throws Exception {
    ECKey key1 = new ECKey();
    ECKey key2 = new ECKey();
    chain.importKeys(key1, key2);
    assertEquals(2, chain.numKeys());
    assertEquals(4, chain.numBloomFilterEntries());
    BloomFilter filter = chain.getFilter(4, 0.001, 100);
    assertTrue(filter.contains(key1.getPubKey()));
    assertTrue(filter.contains(key1.getPubKeyHash()));
    assertTrue(filter.contains(key2.getPubKey()));
    assertTrue(filter.contains(key2.getPubKeyHash()));
    ECKey key3 = new ECKey();
    assertFalse(filter.contains(key3.getPubKey()));
}
 
开发者ID:Grant-Redmond,项目名称:cryptwallet,代码行数:16,代码来源:BasicKeyChainTest.java


示例6: getFilter

import org.bitcoinj.core.BloomFilter; //导入依赖的package包/类
@Override
public BloomFilter getFilter(int size, double falsePositiveRate, long tweak) {
    lock.lock();
    try {
        checkArgument(size >= numBloomFilterEntries(), "Bloom filter too small");
        maybeLookAhead();
        return simpleKeyChain.getFilter(size, falsePositiveRate, tweak);
    } finally {
        lock.unlock();
    }
}
 
开发者ID:filipnyquist,项目名称:lbry-android,代码行数:12,代码来源:SimpleHDKeyChain.java


示例7: testBloomFilter

import org.bitcoinj.core.BloomFilter; //导入依赖的package包/类
@Test
public void testBloomFilter() {
    final List<Integer> integers = Arrays.asList(10, 100, 1000, 2000, 5000, 10000);
    for (Integer i : integers) {
        final BloomFilter res = new BloomFilter(i, 1.0E-5, System.currentTimeMillis());
        System.out.println("" + res );

    }
}
 
开发者ID:RCasatta,项目名称:EternityWallAndroid,代码行数:10,代码来源:EWWalletServiceTest.java


示例8: getLastFilter

import org.bitcoinj.core.BloomFilter; //导入依赖的package包/类
public BloomFilter getLastFilter() {
    return lastFilter;
}
 
开发者ID:guodroid,项目名称:okwallet,代码行数:4,代码来源:FilterMerger.java


示例9: getFilter

import org.bitcoinj.core.BloomFilter; //导入依赖的package包/类
@Override
public BloomFilter getFilter(int size, double falsePositiveRate, long tweak) {
    throw new RuntimeException("Not implemented");
}
 
开发者ID:filipnyquist,项目名称:lbry-android,代码行数:5,代码来源:NxtFamilyKey.java


示例10: getFilter

import org.bitcoinj.core.BloomFilter; //导入依赖的package包/类
/**
 * <p>Gets a bloom filter that contains all of the public keys from this chain, 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 key chain, for the public key and the hash of the public key (address form). For this reason
 * size should be <i>at least</i> 2x the result of {@link #numKeys()}.</p>
 *
 * <p>This is used to generate a {@link 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 org.bitcoinj.core.BloomFilter#BloomFilter(int, double, long)} for a brief
 * explanation of anonymity when using bloom filters, and for the meaning of these parameters.</p>
 */
BloomFilter getFilter(int size, double falsePositiveRate, long tweak);
 
开发者ID:guodroid,项目名称:okwallet,代码行数:14,代码来源:KeyChain.java


示例11: getFilter

import org.bitcoinj.core.BloomFilter; //导入依赖的package包/类
/**
 * <p>Gets a bloom filter that contains all of the public keys from this chain, 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 key chain, for the public key and the hash of the public key (address form). For this reason
 * size should be <i>at least</i> 2x the result of {@link #numKeys()}.</p>
 *
 * <p>This is used to generate a {@link 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 org.bitcoinj.core.BloomFilter#BloomFilter(int, double, long)} for a brief
 * explanation of anonymity when using bloom filters, and for the meaning of these parameters.</p>
 */
public BloomFilter getFilter(int size, double falsePositiveRate, long tweak);
 
开发者ID:HashEngineering,项目名称:namecoinj,代码行数:14,代码来源:KeyChain.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BasicVerifier类代码示例发布时间:2022-05-22
下一篇:
Java NetClientHandler类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap