mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
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.
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user