16 #include <boost/test/unit_test.hpp>
24 unsigned int n = InsecureRandRange(
vHash.size());
25 int bit = InsecureRandBits(8);
26 *(
vHash[n].begin() + (bit>>3)) ^= 1<<(bit&7);
34 static const unsigned int nTxCounts[] = {1, 4, 7, 17, 56, 100, 127, 256, 312, 513, 1000, 4095};
36 for (
int n = 0; n < 12; n++) {
37 unsigned int nTx = nTxCounts[n];
41 for (
unsigned int j=0; j<nTx; j++) {
44 block.
vtx.emplace_back(std::make_shared<const CTransaction>(tx));
50 for (
unsigned int j=0; j<nTx; j++)
51 vTxid[j] = block.
vtx[j]->GetHash();
52 int nHeight = 1, nTx_ = nTx;
59 for (
int att = 1; att < 15; att++) {
61 std::vector<bool> vMatch(nTx,
false);
62 std::vector<uint256> vMatchTxid1;
63 for (
unsigned int j=0; j<nTx; j++) {
64 bool fInclude = InsecureRandBits(att / 2) == 0;
67 vMatchTxid1.push_back(vTxid[j]);
78 unsigned int n = std::min<unsigned int>(nTx, 1 + vMatchTxid1.size()*nHeight);
86 std::vector<uint256> vMatchTxid2;
97 for (
int j=0; j<4; j++) {
100 std::vector<uint256> vMatchTxid3;
std::vector< CTransactionRef > vtx
Data structure that represents a partial merkle tree.
uint256 ExtractMatches(std::vector< uint256 > &vMatch)
extract the matching txid's represented by this partial merkle tree.
std::vector< uint256 > vHash
txids and internal hashes
BOOST_AUTO_TEST_SUITE_END()
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
#define BOOST_FIXTURE_TEST_SUITE(a, b)
#define BOOST_CHECK(expr)
BOOST_AUTO_TEST_CASE(pmt_test1)
A mutable version of CTransaction.
const uint256 UINT256_ZERO
constant uint256 instances