mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-10 14:08:40 +01:00
Convert merkleblock to new serialization
This commit is contained in:
@@ -9,6 +9,24 @@
|
||||
#include <consensus/consensus.h>
|
||||
|
||||
|
||||
std::vector<unsigned char> BitsToBytes(const std::vector<bool>& bits)
|
||||
{
|
||||
std::vector<unsigned char> ret((bits.size() + 7) / 8);
|
||||
for (unsigned int p = 0; p < bits.size(); p++) {
|
||||
ret[p / 8] |= bits[p] << (p % 8);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<bool> BytesToBits(const std::vector<unsigned char>& bytes)
|
||||
{
|
||||
std::vector<bool> ret(bytes.size() * 8);
|
||||
for (unsigned int p = 0; p < ret.size(); p++) {
|
||||
ret[p] = (bytes[p / 8] & (1 << (p % 8))) != 0;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
CMerkleBlock::CMerkleBlock(const CBlock& block, CBloomFilter* filter, const std::set<uint256>* txids)
|
||||
{
|
||||
header = block.GetBlockHeader();
|
||||
|
||||
Reference in New Issue
Block a user