19#include <unordered_map>
23 prefilledtxn(1), header(block) {
28 for (
size_t i = 1; i < block.
vtx.size(); i++) {
29 const CTransaction &tx = *block.
vtx[i];
47 "shorttxids calculation assumes 6-byte shorttxids");
53 const std::vector<std::pair<TxHash, CTransactionRef>> &
extra_txns) {
69 for (
const auto &prefilledtxn :
cmpctblock.prefilledtxn) {
70 if (prefilledtxn.tx->IsNull()) {
103 auto it =
pool->mapTx.begin();
104 while (it !=
pool->mapTx.end()) {
130 "Initialized PartiallyDownloadedBlock for block %s using a "
131 "cmpctblock of size %lu\n",
159 for (
size_t i = 0; i <
txnCount; i++) {
194 "Successfully reconstructed block %s with %lu txn prefilled, %lu "
195 "txn from mempool (incl at least %lu from extra pool) and %lu txn "
202 "Reconstructed block %s required tx %s\n", hash.
ToString(),
203 tx->GetId().ToString());
@ READ_STATUS_CHECKBLOCK_FAILED
enum ReadStatus_t ReadStatus
uint64_t GetShortID(const TxHash &txhash) const
void FillShortTxIDSelector() const
CBlockHeaderAndShortTxIDs()
std::vector< PrefilledTransaction > prefilledtxn
static constexpr int SHORTTXIDS_LENGTH
std::vector< uint64_t > shorttxids
std::vector< CTransactionRef > vtx
const Consensus::Params & GetConsensus() const
Double ended buffer combining vector and stream-like interfaces.
const_iterator begin() const
const_iterator end() const
A hasher class for SHA-256.
CSHA256 & Write(const uint8_t *data, size_t len)
void Finalize(uint8_t hash[OUTPUT_SIZE])
RecursiveMutex cs
This mutex needs to be locked when accessing mapTx or other members that are guarded by it.
virtual uint64_t GetMaxBlockSize() const =0
virtual const CChainParams & GetChainParams() const =0
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)
std::shared_ptr< TransactionShortIdProcessor > shortidProcessor
std::string ToString() const
@ BLOCK_MUTATED
the block's data didn't match the data committed to by the PoW
#define LogPrint(category,...)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
size_t GetSerializeSize(const T &t, int nVersion=0)
uint64_t SipHashUint256(uint64_t k0, uint64_t k1, const uint256 &val)
Optimized SipHash-2-4 implementation for uint256.
A TxHash is the double sha256 hash of the full transaction data.
bool CheckBlock(const CBlock &block, BlockValidationState &state, const Consensus::Params ¶ms, BlockValidationOptions validationOptions)
Functions for validating blocks and updating the block tree.
#define MIN_TRANSACTION_SIZE
static const int PROTOCOL_VERSION
network protocol versioning