Inside Bitcoin
Opening the selected file…
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) 2019-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#ifndef BITCOIN_SCRIPT_KEYORIGIN_H6#define BITCOIN_SCRIPT_KEYORIGIN_H8#include <pubkey.h>9#include <serialize.h>10#include <vector>12struct KeyOriginInfo13{14KeyFingerprint fingerprint; //!< First 32 bits of the Hash160 of the public key at the root of the path15std::vector<uint32_t> path;17friend bool operator==(const KeyOriginInfo& a, const KeyOriginInfo& b) = default;19friend bool operator<(const KeyOriginInfo& a, const KeyOriginInfo& b)20{21// Compare the fingerprints lexicographically22if (a.fingerprint < b.fingerprint) return true;23else if (a.fingerprint > b.fingerprint) return false;25// Compare the sizes of the paths, shorter is "less than"26if (a.path.size() < b.path.size()) {27return true;28} else if (a.path.size() > b.path.size()) {29return false;30}31// Paths same length, compare them lexicographically32return a.path < b.path;33}35SERIALIZE_METHODS(KeyOriginInfo, obj) { READWRITE(obj.fingerprint, obj.path); }37void clear()38{39fingerprint.fill(0);40path.clear();41}42};44#endif // BITCOIN_SCRIPT_KEYORIGIN_H
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.