diff options
| author | Pieter Wuille <[email protected]> | 2016-10-28 17:50:04 -0700 |
|---|---|---|
| committer | Pieter Wuille <[email protected]> | 2016-11-07 13:56:27 -0800 |
| commit | 25a211aa9edfeccc1e65bf699e0b32619cef2157 (patch) | |
| tree | 07345f3d4cc10cd2d2c3419a6074a41c99bb20f2 /src/pubkey.h | |
| parent | Make CSerAction's ForRead() constexpr (diff) | |
| download | discoin-25a211aa9edfeccc1e65bf699e0b32619cef2157.tar.xz discoin-25a211aa9edfeccc1e65bf699e0b32619cef2157.zip | |
Add optimized CSizeComputer serializers
To get the advantages of faster GetSerializeSize() implementations
back that were removed in "Make GetSerializeSize a wrapper on top of
CSizeComputer", reintroduce them in the few places in the form of a
specialized Serialize() implementation. This actually gets us in a
better state than before, as these even get used when they're invoked
indirectly in the serialization of another object.
Diffstat (limited to 'src/pubkey.h')
| -rw-r--r-- | src/pubkey.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pubkey.h b/src/pubkey.h index 15207f89e..949986221 100644 --- a/src/pubkey.h +++ b/src/pubkey.h @@ -210,6 +210,11 @@ struct CExtPubKey { void Decode(const unsigned char code[BIP32_EXTKEY_SIZE]); bool Derive(CExtPubKey& out, unsigned int nChild) const; + void Serialize(CSizeComputer& s) const + { + // Optimized implementation for ::GetSerializeSize that avoids copying. + s.seek(BIP32_EXTKEY_SIZE + 1); // add one byte for the size (compact int) + } template <typename Stream> void Serialize(Stream& s) const { |