Skip to content

Commit d557eff

Browse files
committed
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.
1 parent d43923c commit d557eff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/pubkey.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ class XOnlyPubKey
286286
bool operator==(const XOnlyPubKey& other) const { return m_keydata == other.m_keydata; }
287287
bool operator!=(const XOnlyPubKey& other) const { return m_keydata != other.m_keydata; }
288288
bool operator<(const XOnlyPubKey& other) const { return m_keydata < other.m_keydata; }
289+
290+
//! Implement serialization without length prefixes since it is a fixed length
291+
SERIALIZE_METHODS(XOnlyPubKey, obj) { READWRITE(obj.m_keydata); }
289292
};
290293

291294
struct CExtPubKey {

0 commit comments

Comments
 (0)