diff options
Diffstat (limited to 'src/serialize.h')
-rw-r--r-- | src/serialize.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/serialize.h b/src/serialize.h index edf10440c6..4cc4b0338c 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -1,5 +1,5 @@ // Copyright (c) 2009-2010 Satoshi Nakamoto -// Copyright (c) 2009-2020 The Bitcoin Core developers +// Copyright (c) 2009-2021 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -527,6 +527,19 @@ struct CompactSizeFormatter } }; +class CompactSizeWriter +{ +protected: + uint64_t n; +public: + explicit CompactSizeWriter(uint64_t n_in) : n(n_in) { } + + template<typename Stream> + void Serialize(Stream &s) const { + WriteCompactSize<Stream>(s, n); + } +}; + template<size_t Limit> struct LimitedStringFormatter { |