aboutsummaryrefslogtreecommitdiff
path: root/src/streams.h
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2023-11-28 11:02:24 +0000
committerfanquake <fanquake@gmail.com>2023-11-28 11:24:09 +0000
commitc252a0fc0f4dc7d262b971a5e7ff01508159193b (patch)
tree0ad2c25249f79bb011fa3139d9b1acd4ae486e14 /src/streams.h
parentdc369af3f5146282f82dddbb96a56a04c2c551a6 (diff)
parentfa79a881ce0537e1d74da296a7513730438d2a02 (diff)
downloadbitcoin-c252a0fc0f4dc7d262b971a5e7ff01508159193b.tar.xz
Merge bitcoin/bitcoin#28892: refactor: P2P transport without serialize version and type
fa79a881ce0537e1d74da296a7513730438d2a02 refactor: P2P transport without serialize version and type (MarcoFalke) fa9b5f4fe32c0cfe2e477bb11912756f84a52cfe refactor: NetMsg::Make() without nVersion (MarcoFalke) 66669da4a5ca9edf2a40d20879d9a8aaf2b9e2ee Remove unused Make() overload in netmessagemaker.h (MarcoFalke) fa0ed0794161d937d2d3385963c1aa5624b60d17 refactor: VectorWriter without nVersion (MarcoFalke) Pull request description: Now that the serialize framework ignores the serialize version and serialize type, everything related to it can be removed from the code. This is the first step, removing dead code from the P2P stack. A different pull will remove it from the wallet and other parts. ACKs for top commit: ajtowns: reACK fa79a881ce0537e1d74da296a7513730438d2a02 Tree-SHA512: 785b413580d980f51f0d4f70ea5e0a99ce14cd12cb065393de2f5254891be94a14f4266110c8b87bd2dbc37467676655bce13bdb295ab139749fcd8b61bd5110
Diffstat (limited to 'src/streams.h')
-rw-r--r--src/streams.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/streams.h b/src/streams.h
index 068e2e8efd..5fec289e34 100644
--- a/src/streams.h
+++ b/src/streams.h
@@ -49,17 +49,15 @@ inline void Xor(Span<std::byte> write, Span<const std::byte> key, size_t key_off
*
* The referenced vector will grow as necessary
*/
-class CVectorWriter
+class VectorWriter
{
- public:
-
+public:
/*
- * @param[in] nVersionIn Serialization Version (including any flags)
* @param[in] vchDataIn Referenced byte vector to overwrite/append
* @param[in] nPosIn Starting position. Vector index where writes should start. The vector will initially
* grow as necessary to max(nPosIn, vec.size()). So to append, use vec.size().
*/
- CVectorWriter(int nVersionIn, std::vector<unsigned char>& vchDataIn, size_t nPosIn) : nVersion{nVersionIn}, vchData{vchDataIn}, nPos{nPosIn}
+ VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn) : vchData{vchDataIn}, nPos{nPosIn}
{
if(nPos > vchData.size())
vchData.resize(nPos);
@@ -69,7 +67,7 @@ class CVectorWriter
* @param[in] args A list of items to serialize starting at nPosIn.
*/
template <typename... Args>
- CVectorWriter(int nVersionIn, std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : CVectorWriter{nVersionIn, vchDataIn, nPosIn}
+ VectorWriter(std::vector<unsigned char>& vchDataIn, size_t nPosIn, Args&&... args) : VectorWriter{vchDataIn, nPosIn}
{
::SerializeMany(*this, std::forward<Args>(args)...);
}
@@ -85,19 +83,14 @@ class CVectorWriter
}
nPos += src.size();
}
- template<typename T>
- CVectorWriter& operator<<(const T& obj)
+ template <typename T>
+ VectorWriter& operator<<(const T& obj)
{
::Serialize(*this, obj);
return (*this);
}
- int GetVersion() const
- {
- return nVersion;
- }
private:
- const int nVersion;
std::vector<unsigned char>& vchData;
size_t nPos;
};