@@ -32,7 +32,7 @@ CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter* filter, const std:
3232 header = block.GetBlockHeader ();
3333
3434 std::vector<bool > vMatch;
35- std::vector<uint256 > vHashes;
35+ std::vector<Txid > vHashes;
3636
3737 vMatch.reserve (block.vtx .size ());
3838 vHashes.reserve (block.vtx .size ());
@@ -55,13 +55,13 @@ CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter* filter, const std:
5555}
5656
5757// NOLINTNEXTLINE(misc-no-recursion)
58- uint256 CPartialMerkleTree::CalcHash (int height, unsigned int pos, const std::vector<uint256 > &vTxid) {
58+ uint256 CPartialMerkleTree::CalcHash (int height, unsigned int pos, const std::vector<Txid > &vTxid) {
5959 // we can never have zero txs in a merkle block, we always need the coinbase tx
6060 // if we do not have this assert, we can hit a memory access violation when indexing into vTxid
6161 assert (vTxid.size () != 0 );
6262 if (height == 0 ) {
6363 // hash at height 0 is the txids themselves
64- return vTxid[pos];
64+ return vTxid[pos]. ToUint256 () ;
6565 } else {
6666 // calculate left hash
6767 uint256 left = CalcHash (height-1 , pos*2 , vTxid), right;
@@ -76,7 +76,7 @@ uint256 CPartialMerkleTree::CalcHash(int height, unsigned int pos, const std::ve
7676}
7777
7878// NOLINTNEXTLINE(misc-no-recursion)
79- void CPartialMerkleTree::TraverseAndBuild (int height, unsigned int pos, const std::vector<uint256 > &vTxid, const std::vector<bool > &vMatch) {
79+ void CPartialMerkleTree::TraverseAndBuild (int height, unsigned int pos, const std::vector<Txid > &vTxid, const std::vector<bool > &vMatch) {
8080 // determine whether this node is the parent of at least one matched txid
8181 bool fParentOfMatch = false ;
8282 for (unsigned int p = pos << height; p < (pos+1 ) << height && p < nTransactions; p++)
@@ -95,7 +95,7 @@ void CPartialMerkleTree::TraverseAndBuild(int height, unsigned int pos, const st
9595}
9696
9797// NOLINTNEXTLINE(misc-no-recursion)
98- uint256 CPartialMerkleTree::TraverseAndExtract (int height, unsigned int pos, unsigned int &nBitsUsed, unsigned int &nHashUsed, std::vector<uint256 > &vMatch, std::vector<unsigned int > &vnIndex) {
98+ uint256 CPartialMerkleTree::TraverseAndExtract (int height, unsigned int pos, unsigned int &nBitsUsed, unsigned int &nHashUsed, std::vector<Txid > &vMatch, std::vector<unsigned int > &vnIndex) {
9999 if (nBitsUsed >= vBits.size ()) {
100100 // overflowed the bits array - failure
101101 fBad = true ;
@@ -111,7 +111,7 @@ uint256 CPartialMerkleTree::TraverseAndExtract(int height, unsigned int pos, uns
111111 }
112112 const uint256 &hash = vHash[nHashUsed++];
113113 if (height==0 && fParentOfMatch ) { // in case of height 0, we have a matched txid
114- vMatch.push_back (hash);
114+ vMatch.push_back (Txid::FromUint256 ( hash) );
115115 vnIndex.push_back (pos);
116116 }
117117 return hash;
@@ -133,7 +133,7 @@ uint256 CPartialMerkleTree::TraverseAndExtract(int height, unsigned int pos, uns
133133 }
134134}
135135
136- CPartialMerkleTree::CPartialMerkleTree (const std::vector<uint256 > &vTxid, const std::vector<bool > &vMatch) : nTransactions(vTxid.size()), fBad(false ) {
136+ CPartialMerkleTree::CPartialMerkleTree (const std::vector<Txid > &vTxid, const std::vector<bool > &vMatch) : nTransactions(vTxid.size()), fBad(false ) {
137137 // reset state
138138 vBits.clear ();
139139 vHash.clear ();
@@ -149,7 +149,7 @@ CPartialMerkleTree::CPartialMerkleTree(const std::vector<uint256> &vTxid, const
149149
150150CPartialMerkleTree::CPartialMerkleTree () : nTransactions(0 ), fBad(true ) {}
151151
152- uint256 CPartialMerkleTree::ExtractMatches (std::vector<uint256 > &vMatch, std::vector<unsigned int > &vnIndex) {
152+ uint256 CPartialMerkleTree::ExtractMatches (std::vector<Txid > &vMatch, std::vector<unsigned int > &vnIndex) {
153153 vMatch.clear ();
154154 // An empty set will not work
155155 if (nTransactions == 0 )
0 commit comments