15 #include <boost/test/unit_test.hpp>
24 *(
vHash[n].begin() + (bit>>3)) ^= 1<<(bit&7);
32 static const unsigned int nTxCounts[] = {1, 4, 7, 17, 56, 100, 127, 256, 312, 513, 1000, 4095};
34 for (
int i = 0; i < 12; i++) {
35 unsigned int nTx = nTxCounts[i];
39 for (
unsigned int j=0; j<nTx; j++) {
47 std::vector<uint256> vTxid(nTx,
uint256());
48 for (
unsigned int j=0; j<nTx; j++)
49 vTxid[j] = block.
vtx[j]->GetHash();
57 for (
int att = 1; att < 15; att++) {
59 std::vector<bool> vMatch(nTx,
false);
60 std::vector<uint256> vMatchTxid1;
61 for (
unsigned int j=0; j<nTx; j++) {
65 vMatchTxid1.push_back(vTxid[j]);
76 unsigned int n = std::min<unsigned int>(nTx, 1 + vMatchTxid1.size()*
nHeight);
84 std::vector<uint256> vMatchTxid2;
85 std::vector<unsigned int> vIndex;
96 for (
int j=0; j<4; j++) {
99 std::vector<uint256> vMatchTxid3;
109 std::vector<uint256> vTxid{
117 std::vector<bool> vMatch = {
false,
false,
false,
false,
false,
false,
false,
false,
false,
true,
true,
false};
120 std::vector<unsigned int> vIndex;
std::vector< CTransactionRef > vtx
Data structure that represents a partial merkle tree.
uint256 ExtractMatches(std::vector< uint256 > &vMatch, std::vector< unsigned int > &vnIndex)
extract the matching txid's represented by this partial merkle tree and their respective indices with...
std::vector< uint256 > vHash
txids and internal hashes
Double ended buffer combining vector and stream-like interfaces.
constexpr bool IsNull() const
BOOST_AUTO_TEST_SUITE_END()
uint256 BlockMerkleRoot(const CBlock &block, bool *mutated)
#define BOOST_CHECK(expr)
BOOST_AUTO_TEST_CASE(pmt_test1)
static CTransactionRef MakeTransactionRef(Tx &&txIn)
A mutable version of CTransaction.
static uint64_t InsecureRandRange(uint64_t range)
static uint64_t InsecureRandBits(int bits)