diff options
author | Ben Woosley <ben.woosley@gmail.com> | 2018-06-14 19:48:30 -0500 |
---|---|---|
committer | Ben Woosley <ben.woosley@gmail.com> | 2018-09-11 00:58:13 -0400 |
commit | 893628be0166b4096b6e52f516e0f65bb63a75a2 (patch) | |
tree | 59b7512c8f429312dd137429251c0df9f89942a4 /src | |
parent | da74db0940720407fafaf3582bbaf9c81a4d3b4d (diff) |
Drop minor GetSerializeSize template
Now that `GetType()` is not propagated, the benefits are not worth the code.
Diffstat (limited to 'src')
-rw-r--r-- | src/script/sign.h | 2 | ||||
-rw-r--r-- | src/serialize.h | 12 | ||||
-rw-r--r-- | src/validation.cpp | 4 |
3 files changed, 6 insertions, 12 deletions
diff --git a/src/script/sign.h b/src/script/sign.h index 18b7320998..2fc4575e59 100644 --- a/src/script/sign.h +++ b/src/script/sign.h @@ -147,7 +147,7 @@ static constexpr uint8_t PSBT_SEPARATOR = 0x00; template<typename Stream, typename... X> void SerializeToVector(Stream& s, const X&... args) { - WriteCompactSize(s, GetSerializeSizeMany(s, args...)); + WriteCompactSize(s, GetSerializeSizeMany(s.GetVersion(), args...)); SerializeMany(s, args...); } diff --git a/src/serialize.h b/src/serialize.h index ae8e11a43a..2d0cfbbbf0 100644 --- a/src/serialize.h +++ b/src/serialize.h @@ -983,16 +983,10 @@ size_t GetSerializeSize(const T& t, int nVersion = 0) return (CSizeComputer(nVersion) << t).size(); } -template <typename S, typename T> -size_t GetSerializeSize(const S& s, const T& t) +template <typename... T> +size_t GetSerializeSizeMany(int nVersion, const T&... t) { - return (CSizeComputer(s.GetVersion()) << t).size(); -} - -template <typename S, typename... T> -size_t GetSerializeSizeMany(const S& s, const T&... t) -{ - CSizeComputer sc(s.GetType(), s.GetVersion()); + CSizeComputer sc(nVersion); SerializeMany(sc, t...); return sc.size(); } diff --git a/src/validation.cpp b/src/validation.cpp index 088dbf30fc..a1d0b3d046 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -1060,7 +1060,7 @@ static bool WriteBlockToDisk(const CBlock& block, CDiskBlockPos& pos, const CMes return error("WriteBlockToDisk: OpenBlockFile failed"); // Write index header - unsigned int nSize = GetSerializeSize(fileout, block); + unsigned int nSize = GetSerializeSize(block, fileout.GetVersion()); fileout << messageStart << nSize; // Write block @@ -1470,7 +1470,7 @@ bool UndoWriteToDisk(const CBlockUndo& blockundo, CDiskBlockPos& pos, const uint return error("%s: OpenUndoFile failed", __func__); // Write index header - unsigned int nSize = GetSerializeSize(fileout, blockundo); + unsigned int nSize = GetSerializeSize(blockundo, fileout.GetVersion()); fileout << messageStart << nSize; // Write undo data |