Changeset View
Changeset View
Standalone View
Standalone View
src/test/blockencodings_tests.cpp
Show First 20 Lines • Show All 160 Lines • ▼ Show 20 Lines | public: | ||||
uint64_t GetShortID(const TxHash &txhash) const { | uint64_t GetShortID(const TxHash &txhash) const { | ||||
CDataStream stream(SER_NETWORK, PROTOCOL_VERSION); | CDataStream stream(SER_NETWORK, PROTOCOL_VERSION); | ||||
stream << *this; | stream << *this; | ||||
CBlockHeaderAndShortTxIDs base; | CBlockHeaderAndShortTxIDs base; | ||||
stream >> base; | stream >> base; | ||||
return base.GetShortID(txhash); | return base.GetShortID(txhash); | ||||
} | } | ||||
ADD_SERIALIZE_METHODS; | SERIALIZE_METHODS(TestHeaderAndShortIDs, obj) { | ||||
READWRITE( | |||||
template <typename Stream, typename Operation> | obj.header, obj.nonce, | ||||
inline void SerializationOp(Stream &s, Operation ser_action) { | Using<VectorFormatter<CustomUintFormatter< | ||||
READWRITE(header); | CBlockHeaderAndShortTxIDs::SHORTTXIDS_LENGTH>>>(obj.shorttxids), | ||||
READWRITE(nonce); | obj.prefilledtxn); | ||||
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); | |||||
} | } | ||||
}; | }; | ||||
BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest) { | BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest) { | ||||
CTxMemPool pool; | CTxMemPool pool; | ||||
TestMemPoolEntryHelper entry; | TestMemPoolEntryHelper entry; | ||||
CBlock block(BuildBlockTestCase()); | CBlock block(BuildBlockTestCase()); | ||||
▲ Show 20 Lines • Show All 291 Lines • Show Last 20 Lines |