org.bitcoinj.core.BlockChain.trackFilteredTransactions()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.bitcoinj.core.BlockChain.trackFilteredTransactions()方法的一些代码示例,展示了BlockChain.trackFilteredTransactions()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BlockChain.trackFilteredTransactions()方法的具体详情如下:
包路径:org.bitcoinj.core.BlockChain
类名称:BlockChain
方法名:trackFilteredTransactions

BlockChain.trackFilteredTransactions介绍

暂无

代码示例

代码示例来源:origin: fr.acinq/bitcoinj-core

@Override
  public boolean add(FilteredBlock block) throws VerificationException, PrunedException {
    boolean success = super.add(block);
    if (success) {
      trackFilteredTransactions(block.getTransactionCount());
    }
    return success;
  }
}

代码示例来源:origin: cash.bitcoinj/bitcoinj-core

@Override
  public boolean add(FilteredBlock block) throws VerificationException, PrunedException {
    boolean success = super.add(block);
    if (success) {
      trackFilteredTransactions(block.getTransactionCount());
    }
    return success;
  }
}

代码示例来源:origin: greenaddress/GreenBits

@Override
  public boolean add(FilteredBlock block) throws VerificationException, PrunedException {
    boolean success = super.add(block);
    if (success) {
      trackFilteredTransactions(block.getTransactionCount());
    }
    return success;
  }
}

代码示例来源:origin: HashEngineering/dashj

@Override
  public boolean add(FilteredBlock block) throws VerificationException, PrunedException {
    boolean success = super.add(block);
    if (success) {
      trackFilteredTransactions(block.getTransactionCount());
    }
    return success;
  }
}

代码示例来源:origin: greenaddress/GreenBits

@Test
public void falsePositives() throws Exception {
  double decay = AbstractBlockChain.FP_ESTIMATOR_ALPHA;
  assertTrue(0 == chain.getFalsePositiveRate()); // Exactly
  chain.trackFalsePositives(55);
  assertEquals(decay * 55, chain.getFalsePositiveRate(), 1e-4);
  chain.trackFilteredTransactions(550);
  double rate1 = chain.getFalsePositiveRate();
  // Run this scenario a few more time for the filter to converge
  for (int i = 1 ; i < 10 ; i++) {
    chain.trackFalsePositives(55);
    chain.trackFilteredTransactions(550);
  }
  // Ensure we are within 10%
  assertEquals(0.1, chain.getFalsePositiveRate(), 0.01);
  // Check that we get repeatable results after a reset
  chain.resetFalsePositiveEstimate();
  assertTrue(0 == chain.getFalsePositiveRate()); // Exactly
  chain.trackFalsePositives(55);
  assertEquals(decay * 55, chain.getFalsePositiveRate(), 1e-4);
  chain.trackFilteredTransactions(550);
  assertEquals(rate1, chain.getFalsePositiveRate(), 1e-4);
}

相关文章