From d557eff2add151781537978e27d6f1aff1b83ef7 Mon Sep 17 00:00:00 2001 From: Andrew Chow Date: Mon, 12 Jul 2021 17:06:20 -0400 Subject: [PATCH] Add serialization methods to XOnlyPubKey It is useful to have serialzation methods for XOnlyPubKey. These will serialize the internal uint256, so it is not prefixed with the length as CPubKey does. --- src/pubkey.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pubkey.h b/src/pubkey.h index dfe06f834c9..463efe1b003 100644 --- a/src/pubkey.h +++ b/src/pubkey.h @@ -286,6 +286,9 @@ public: bool operator==(const XOnlyPubKey& other) const { return m_keydata == other.m_keydata; } bool operator!=(const XOnlyPubKey& other) const { return m_keydata != other.m_keydata; } bool operator<(const XOnlyPubKey& other) const { return m_keydata < other.m_keydata; } + + //! Implement serialization without length prefixes since it is a fixed length + SERIALIZE_METHODS(XOnlyPubKey, obj) { READWRITE(obj.m_keydata); } }; struct CExtPubKey {