5#ifndef BITCOIN_BLOCKENCODINGS_H
6#define BITCOIN_BLOCKENCODINGS_H
39 std::vector<CTransactionRef>
txn;
58 template <
typename Stream>
void SerData(Stream &s) { s <<
tx; }
59 template <
typename Stream>
void UnserData(Stream &s) { s >>
tx; }
111 obj.header, obj.nonce,
117 if (ser_action.ForRead() && obj.prefilledtxn.size() > 0) {
121 uint64_t highestPrefilledIndex = obj.prefilledtxn.back().index;
124 if (highestPrefilledIndex + obj.shorttxids.size() >
125 std::numeric_limits<uint32_t>::max()) {
126 throw std::ios_base::failure(
"indexes overflowed 32 bits");
132 if (highestPrefilledIndex >= obj.BlockTxCount()) {
133 throw std::ios_base::failure(
"non contiguous indexes");
136 obj.FillShortTxIDSelector();
145 return lhs->GetHash() == rhs->GetHash();
173 const std::vector<std::pair<TxHash, CTransactionRef>> &extra_txn);
176 const std::vector<CTransactionRef> &vtx_missing);
@ READ_STATUS_CHECKBLOCK_FAILED
enum ReadStatus_t ReadStatus
std::vector< CTransactionRef > txn
BlockTransactions(const BlockTransactionsRequest &req)
SERIALIZE_METHODS(BlockTransactions, obj)
std::vector< uint32_t > indices
SERIALIZE_METHODS(BlockTransactionsRequest, obj)
size_t BlockTxCount() const
uint64_t GetShortID(const TxHash &txhash) const
void FillShortTxIDSelector() const
SERIALIZE_METHODS(CBlockHeaderAndShortTxIDs, obj)
CBlockHeaderAndShortTxIDs()
std::vector< PrefilledTransaction > prefilledtxn
static constexpr int SHORTTXIDS_LENGTH
std::vector< uint64_t > shorttxids
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
ReadStatus InitData(const CBlockHeaderAndShortTxIDs &cmpctblock, const std::vector< std::pair< TxHash, CTransactionRef > > &extra_txn)
bool IsTxAvailable(size_t index) const
ReadStatus FillBlock(CBlock &block, const std::vector< CTransactionRef > &vtx_missing)
PartiallyDownloadedBlock(const Config &configIn, CTxMemPool *poolIn)
std::shared_ptr< TransactionShortIdProcessor > shortidProcessor
std::shared_ptr< const CTransaction > CTransactionRef
static Wrapper< Formatter, T & > Using(T &&t)
Cause serialization/deserialization of an object to be done using a specified formatter class.
A BlockHash is a unqiue identifier for a block.
bool operator()(const CTransactionRef &lhs, const CTransactionRef &rhs) const
void UnserData(Stream &s)
uint32_t getIndex(const PrefilledTransaction &pt) const
CTransactionRef getItem(const PrefilledTransaction &pt) const
A TxHash is the double sha256 hash of the full transaction data.