/
githubmirror
/
bitcoin
Обзор
Документация
Войти
/
githubmirror
/
bitcoin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/script/keyorigin.h
44 строки
1 KB
David Gumberg
script: qa: Improve Key::Fingerprint type safety
26 июн 2026, 03:34
26 июн 2026, 03:34
c9a70f9
Код
Авторство
О чём код?
// Copyright (c) 2019-present The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef BITCOIN_SCRIPT_KEYORIGIN_H #define BITCOIN_SCRIPT_KEYORIGIN_H #include <pubkey.h> #include <serialize.h> #include <vector> struct KeyOriginInfo { KeyFingerprint fingerprint; //!< First 32 bits of the Hash160 of the public key at the root of the path std::vector<uint32_t> path; friend bool operator==(const KeyOriginInfo& a, const KeyOriginInfo& b) = default; friend bool operator<(const KeyOriginInfo& a, const KeyOriginInfo& b) { // Compare the fingerprints lexicographically if (a.fingerprint < b.fingerprint) return true; else if (a.fingerprint > b.fingerprint) return false; // Compare the sizes of the paths, shorter is "less than" if (a.path.size() < b.path.size()) { return true; } else if (a.path.size() > b.path.size()) { return false; } // Paths same length, compare them lexicographically return a.path < b.path; } SERIALIZE_METHODS(KeyOriginInfo, obj) { READWRITE(obj.fingerprint, obj.path); } void clear() { fingerprint.fill(0); path.clear(); } }; #endif // BITCOIN_SCRIPT_KEYORIGIN_H