5 #ifndef BITCOIN_BLOCKENCODINGS_H 6 #define BITCOIN_BLOCKENCODINGS_H 27 template<
typename Stream,
typename I>
28 void Ser(Stream& s, I v)
30 if (v < m_shift || v >= std::numeric_limits<uint64_t>::max())
throw std::ios_base::failure(
"differential value overflow");
34 template<
typename Stream,
typename I>
39 if (m_shift < n || m_shift >= std::numeric_limits<uint64_t>::max() ||
m_shift < std::numeric_limits<I>::min() ||
m_shift > std::numeric_limits<I>::max())
throw std::ios_base::failure(
"differential value overflow");
60 std::vector<CTransactionRef>
txn;
126 if (ser_action.ForRead()) {
127 if (obj.BlockTxCount() > std::numeric_limits<uint16_t>::max()) {
128 throw std::ios_base::failure(
"indexes overflowed 16 bits");
130 obj.FillShortTxIDSelector();
144 using CheckBlockFn = std::function<bool(const CBlock&, BlockValidationState&, const Consensus::Params&, bool, bool)>;
155 #endif // BITCOIN_BLOCKENCODINGS_H std::shared_ptr< const CTransaction > CTransactionRef
enum ReadStatus_t ReadStatus
ReadStatus FillBlock(CBlock &block, const std::vector< CTransactionRef > &vtx_missing)
uint64_t ReadCompactSize(Stream &is, bool range_check=true)
Decode a CompactSize-encoded variable-length integer.
std::vector< uint16_t > indexes
std::vector< CTransactionRef > txn_available
BlockTransactions(const BlockTransactionsRequest &req)
CheckBlockFn m_check_block_mock
void FillShortTxIDSelector() const
PartiallyDownloadedBlock(CTxMemPool *poolIn)
static Wrapper< Formatter, T & > Using(T &&t)
Cause serialization/deserialization of an object to be done using a specified formatter class...
Transaction validation functions.
SERIALIZE_METHODS(PrefilledTransaction, obj)
CBlockHeaderAndShortTxIDs()=default
Dummy for deserialization.
std::function< bool(const CBlock &, BlockValidationState &, const Consensus::Params &, bool, bool)> CheckBlockFn
BlockTransactions()=default
std::vector< CTransactionRef > txn
void WriteCompactSize(SizeComputer &os, uint64_t nSize)
SERIALIZE_METHODS(BlockTransactions, obj)
static constexpr int SHORTTXIDS_LENGTH
Parameters that influence chain consensus.
ReadStatus InitData(const CBlockHeaderAndShortTxIDs &cmpctblock, const std::vector< CTransactionRef > &extra_txn)
std::vector< uint64_t > shorttxids
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
std::vector< PrefilledTransaction > prefilledtxn
bool IsTxAvailable(size_t index) const
SERIALIZE_METHODS(CBlockHeaderAndShortTxIDs, obj)
size_t BlockTxCount() const
SERIALIZE_METHODS(BlockTransactionsRequest, obj)
static constexpr TransactionSerParams TX_WITH_WITNESS
uint64_t GetShortID(const Wtxid &wtxid) const
transaction_identifier represents the two canonical transaction identifier types (txid, wtxid).