Some missing non-Dash-specifc serializations

This commit is contained in:
UdjinM6 2021-05-27 17:59:09 +03:00
parent 9029448233
commit 64d4a48a09
No known key found for this signature in database
GPG Key ID: 83592BD1400D58D9
5 changed files with 19 additions and 36 deletions

View File

@ -85,12 +85,9 @@ struct CDiskBlockPos
int nFile;
unsigned int nPos;
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITE(VARINT(nFile, VarIntMode::NONNEGATIVE_SIGNED));
READWRITE(VARINT(nPos));
SERIALIZE_METHODS(CDiskBlockPos, obj)
{
READWRITE(VARINT(obj.nFile, VarIntMode::NONNEGATIVE_SIGNED), VARINT(obj.nPos));
}
CDiskBlockPos() {

View File

@ -42,7 +42,7 @@ public:
}
template<typename T>
OverrideStream<Stream>& operator>>(T& obj)
OverrideStream<Stream>& operator>>(T&& obj)
{
// Unserialize from this stream
::Unserialize(*this, obj);

View File

@ -46,12 +46,10 @@ struct CDiskTxPos : public CDiskBlockPos
{
unsigned int nTxOffset; // after header
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITEAS(CDiskBlockPos, *this);
READWRITE(VARINT(nTxOffset));
SERIALIZE_METHODS(CDiskTxPos, obj)
{
READWRITEAS(CDiskBlockPos, obj);
READWRITE(VARINT(obj.nTxOffset));
}
CDiskTxPos(const CDiskBlockPos &blockIn, unsigned int nTxOffsetIn) : CDiskBlockPos(blockIn.nFile, blockIn.nPos), nTxOffset(nTxOffsetIn) {

View File

@ -28,7 +28,7 @@ struct TxInUndoFormatter
// Required to maintain compatibility with older undo format.
::Serialize(s, (unsigned char)0);
}
::Serialize(s, Using<TxOutCompression>(REF(txout.out)));
::Serialize(s, Using<TxOutCompression>(txout.out));
}
template<typename Stream>
@ -44,7 +44,7 @@ struct TxInUndoFormatter
unsigned int nVersionDummy;
::Unserialize(s, VARINT(nVersionDummy));
}
::Unserialize(s, Using<TxOutCompression>(REF(txout.out)));
::Unserialize(s, Using<TxOutCompression>(txout.out));
}
};

View File

@ -236,15 +236,10 @@ public:
tx = std::move(arg);
}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
SERIALIZE_METHODS(CMerkleTx, obj)
{
std::vector<uint256> vMerkleBranch; // For compatibility with older versions.
READWRITE(tx);
READWRITE(hashBlock);
READWRITE(vMerkleBranch);
READWRITE(nIndex);
READWRITE(obj.tx, obj.hashBlock, vMerkleBranch, obj.nIndex);
}
void SetMerkleBranch(const CBlockIndex* pIndex, int posInBlock);
@ -581,17 +576,12 @@ public:
explicit CWalletKey(int64_t nExpires=0);
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
SERIALIZE_METHODS(CWalletKey, obj)
{
int nVersion = s.GetVersion();
if (!(s.GetType() & SER_GETHASH))
READWRITE(nVersion);
READWRITE(vchPrivKey);
READWRITE(nTimeCreated);
READWRITE(nTimeExpires);
READWRITE(LIMITED_STRING(strComment, 65536));
READWRITE(obj.vchPrivKey, obj.nTimeCreated, obj.nTimeExpires, LIMITED_STRING(obj.strComment, 65536));
}
};
@ -1320,14 +1310,12 @@ public:
vchPubKey = CPubKey();
}
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
SERIALIZE_METHODS(CAccount, obj)
{
int nVersion = s.GetVersion();
if (!(s.GetType() & SER_GETHASH))
READWRITE(nVersion);
READWRITE(vchPubKey);
READWRITE(obj.vchPubKey);
}
};