Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2025-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <blockencodings.h>6#include <streams.h>7#include <random.h>8#include <test/fuzz/fuzz.h>10#include <vector>12FUZZ_TARGET(difference_formatter)13{14const auto block_hash = InsecureRandomContext{{}}.rand256();15DataStream ss{};16ss << block_hash << std::span{buffer};18// Test deserialization19try {20BlockTransactionsRequest test_container;21ss >> test_container;22assert(test_container.blockhash == block_hash);24// Invariant: strictly monotonic increasing (no duplicates allowed)25for (size_t i = 1; i < test_container.indexes.size(); ++i) {26assert(test_container.indexes[i] > test_container.indexes[i-1]);27}29} catch (const std::ios_base::failure&) {30// Expected for malformed input31}32}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.