本文整理汇总了C++中BinaryArray::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ BinaryArray::insert方法的具体用法?C++ BinaryArray::insert怎么用?C++ BinaryArray::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BinaryArray
的用法示例。
在下文中一共展示了BinaryArray::insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_block_hashing_blob
bool get_block_hashing_blob(const Block& b, BinaryArray& ba) {
if (!toBinaryArray(static_cast<const BlockHeader&>(b), ba)) {
return false;
}
Hash treeRootHash = get_tx_tree_hash(b);
ba.insert(ba.end(), treeRootHash.data, treeRootHash.data + 32);
auto transactionCount = asBinaryArray(Tools::get_varint_data(b.transactionHashes.size() + 1));
ba.insert(ba.end(), transactionCount.begin(), transactionCount.end());
return true;
}
示例2: getBlockHashingBinaryArray
const Crypto::Hash& CachedBlock::getBlockHash() const {
if (!blockHash.is_initialized()) {
BinaryArray blockBinaryArray = getBlockHashingBinaryArray();
if (BLOCK_MAJOR_VERSION_2 <= block.majorVersion) {
const auto& parentBlock = getParentBlockHashingBinaryArray(false);
blockBinaryArray.insert(blockBinaryArray.end(), parentBlock.begin(), parentBlock.end());
}
blockHash = getObjectHash(blockBinaryArray);
}
return blockHash.get();
}
示例3: get_block_hash
bool get_block_hash(const Block& b, Hash& res) {
BinaryArray ba;
if (!get_block_hashing_blob(b, ba)) {
return false;
}
// The header of block version 1 differs from headers of blocks starting from v.2
if (BLOCK_MAJOR_VERSION_2 == b.majorVersion || BLOCK_MAJOR_VERSION_3 == b.majorVersion) {
BinaryArray parent_blob;
auto serializer = makeParentBlockSerializer(b, true, false);
if (!toBinaryArray(serializer, parent_blob))
return false;
ba.insert(ba.end(), parent_blob.begin(), parent_blob.end());
}
return getObjectHash(ba, res);
}