aboutsummaryrefslogtreecommitdiff
path: root/src/streams.h
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-06-02 10:13:09 +0100
committerfanquake <fanquake@gmail.com>2023-06-02 10:28:01 +0100
commit83c7269965c330ae1f4d85b1ba652717c9080914 (patch)
treea2b788f1def5d5e0d8c09a0ec86cb8cb61be2a11 /src/streams.h
parentdba757fb35ac2b25994f026af99c4dafb108136c (diff)
parent5cd0717a54ce7a2065b29d90717aa2eb1c5e302d (diff)
downloadbitcoin-83c7269965c330ae1f4d85b1ba652717c9080914.tar.xz
Merge bitcoin/bitcoin#27800: streams: Drop confusing DataStream::Serialize method and << operator
5cd0717a54ce7a2065b29d90717aa2eb1c5e302d streams: Drop confusing DataStream::Serialize method and << operator (Ryan Ofsky) Pull request description: DataStream Serialize method has surprising behavior because it just serializes raw bytes without a length prefix. When you serialize a string or vector, a length prefix is serialized before the raw object contents so the object can be unambiguously deserialized later. But DataStreams don't support deserializing at all and just dump the raw bytes. Having this inconsistency is not necessary and could be confusing (see https://github.com/bitcoin/bitcoin/pull/27790#discussion_r1212315030) so this PR just drops the DataStream::Serialize method. ACKs for top commit: furszy: lgtm ACK 5cd0717a MarcoFalke: lgtm ACK 5cd0717a54ce7a2065b29d90717aa2eb1c5e302d 🌙 Tree-SHA512: 49dd117de266f091a5336b13a91c5d8658abe1b3a0a9c51c8b5f6a2e0e814781b73afc39256353e79dade603a8a2761e8536716d1a48499720c266f4500477e2
Diffstat (limited to 'src/streams.h')
-rw-r--r--src/streams.h8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/streams.h b/src/streams.h
index e346aa0a3f..03df20b5db 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -293,14 +293,6 @@ public:
vch.insert(vch.end(), src.begin(), src.end());
}
- template<typename Stream>
- void Serialize(Stream& s) const
- {
- // Special case: stream << stream concatenates like stream += stream
- if (!vch.empty())
- s.write(MakeByteSpan(vch));
- }
-
template<typename T>
DataStream& operator<<(const T& obj)
{