mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-19 21:31:33 +02:00
Convert blockencodings_tests to new serialization
This commit is contained in:
parent
73747afbbe
commit
2b1f85e8c5
@ -92,12 +92,13 @@ private:
|
||||
|
||||
friend class PartiallyDownloadedBlock;
|
||||
|
||||
static const int SHORTTXIDS_LENGTH = 6;
|
||||
protected:
|
||||
std::vector<uint64_t> shorttxids;
|
||||
std::vector<PrefilledTransaction> prefilledtxn;
|
||||
|
||||
public:
|
||||
static constexpr int SHORTTXIDS_LENGTH = 6;
|
||||
|
||||
CBlockHeader header;
|
||||
|
||||
// Dummy for deserialization
|
||||
|
@ -132,24 +132,7 @@ public:
|
||||
return base.GetShortID(txhash);
|
||||
}
|
||||
|
||||
ADD_SERIALIZE_METHODS;
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action) {
|
||||
READWRITE(header);
|
||||
READWRITE(nonce);
|
||||
size_t shorttxids_size = shorttxids.size();
|
||||
READWRITE(VARINT(shorttxids_size));
|
||||
shorttxids.resize(shorttxids_size);
|
||||
for (size_t i = 0; i < shorttxids.size(); i++) {
|
||||
uint32_t lsb = shorttxids[i] & 0xffffffff;
|
||||
uint16_t msb = (shorttxids[i] >> 32) & 0xffff;
|
||||
READWRITE(lsb);
|
||||
READWRITE(msb);
|
||||
shorttxids[i] = (uint64_t(msb) << 32) | uint64_t(lsb);
|
||||
}
|
||||
READWRITE(prefilledtxn);
|
||||
}
|
||||
SERIALIZE_METHODS(TestHeaderAndShortIDs, obj) { READWRITE(obj.header, obj.nonce, Using<VectorFormatter<CustomUintFormatter<CBlockHeaderAndShortTxIDs::SHORTTXIDS_LENGTH>>>(obj.shorttxids), obj.prefilledtxn); }
|
||||
};
|
||||
|
||||
BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
|
||||
|
Loading…
x
Reference in New Issue
Block a user