aboutsummaryrefslogtreecommitdiff
path: root/src/serialize.h
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-10-02 15:49:33 -0400
committerAndrew Chow <achow101-github@achow101.com>2021-12-10 08:29:24 -0500
commit3235847473e36070cbe9b0e9deacdd8d8d9428fe (patch)
treef3ce3a785b7d5f147e35a2ec8005fcb1adf301b4 /src/serialize.h
parent65b49f60a4cf521889297b2006f66efa11d769c5 (diff)
downloadbitcoin-3235847473e36070cbe9b0e9deacdd8d8d9428fe.tar.xz
Types are compact size uints
Diffstat (limited to 'src/serialize.h')
-rw-r--r--src/serialize.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/serialize.h b/src/serialize.h
index edf10440c6..873361fe9e 100644
--- a/src/serialize.h
+++ b/src/serialize.h
@@ -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
{