aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2018-11-06 09:23:37 -0500
committerAndrew Chow <achow101-github@achow101.com>2019-02-14 17:58:25 -0500
commiteab63bc264a35cf21738e8535773e3d36524c3fe (patch)
tree557800411c6e5918e1768b0c215cb1fe68df54f3 /src/script
parent345bff6013e0d1a7eb0a08a071723b27f0460b77 (diff)
Store key origin info in key metadata
Store the master key fingerprint and derivation path in the key metadata. hdKeypath is kept to indicate the seed and for backwards compatibility, but all key derivation path output uses the key origin info instead of hdKeypath.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/sign.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/script/sign.h b/src/script/sign.h
index 64eb3eb8e5..3e9a3b38c6 100644
--- a/src/script/sign.h
+++ b/src/script/sign.h
@@ -22,13 +22,27 @@ struct CMutableTransaction;
struct KeyOriginInfo
{
- unsigned char fingerprint[4];
+ unsigned char fingerprint[4]; //!< 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)
{
return std::equal(std::begin(a.fingerprint), std::end(a.fingerprint), std::begin(b.fingerprint)) && a.path == b.path;
}
+
+ ADD_SERIALIZE_METHODS;
+ template <typename Stream, typename Operation>
+ inline void SerializationOp(Stream& s, Operation ser_action)
+ {
+ READWRITE(fingerprint);
+ READWRITE(path);
+ }
+
+ void clear()
+ {
+ memset(fingerprint, 0, 4);
+ path.clear();
+ }
};
/** An interface to be implemented by keystores that support signing. */