Bitcoin
keyorigin.h
Go to the documentation of this file.
1 // Copyright (c) 2019 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_SCRIPT_KEYORIGIN_H
6 #define BITCOIN_SCRIPT_KEYORIGIN_H
7 
8 #include <serialize.h>
9 #include <streams.h>
10 #include <vector>
11 
13 {
14  unsigned char fingerprint[4];
15  std::vector<uint32_t> path;
16 
17  friend bool operator==(const KeyOriginInfo& a, const KeyOriginInfo& b)
18  {
19  return std::equal(std::begin(a.fingerprint), std::end(a.fingerprint), std::begin(b.fingerprint)) && a.path == b.path;
20  }
21 
23  template <typename Stream, typename Operation>
24  inline void SerializationOp(Stream& s, Operation ser_action)
25  {
27  READWRITE(path);
28  }
29 
30  void clear()
31  {
32  memset(fingerprint, 0, 4);
33  path.clear();
34  }
35 };
36 
37 #endif // BITCOIN_SCRIPT_KEYORIGIN_H
ADD_SERIALIZE_METHODS
Definition: keyorigin.h:22
end
Definition: optimize-pngs.py:40
void SerializationOp(Stream &s, Operation ser_action)
Definition: keyorigin.h:24
std::vector< uint32_t > path
Definition: keyorigin.h:15
Definition: keyorigin.h:12
void clear()
Definition: keyorigin.h:30
#define READWRITE(...)
Definition: serialize.h:184
unsigned char fingerprint[4]
First 32 bits of the Hash160 of the public key at the root of the path.
Definition: keyorigin.h:14
friend bool operator==(const KeyOriginInfo &a, const KeyOriginInfo &b)
Definition: keyorigin.h:17