#pragma once #include #include #include #include #include MW_NAMESPACE class BlockBuilder { public: using Ptr = std::shared_ptr; /// /// Constructs a new BlockBuilder for assembling an MW ext block incrementally (tx by tx). /// /// The height of the block being built. /// The CoinsView representing the latest state of the active chain. Must not be null. /// A non-null BlockBuilder BlockBuilder(const uint64_t height, const mw::ICoinsView::Ptr& pCoinsView) : m_height(height), m_weight(0), m_pCoinsView(std::make_shared(pCoinsView)) { } bool AddTransaction(const Transaction::CPtr& pTransaction, const std::vector& pegins); mw::Block::Ptr BuildBlock() const; private: uint64_t m_height; uint64_t m_weight; mw::CoinsViewCache::Ptr m_pCoinsView; std::vector m_stagedTxs; std::set m_stagedOutputs; }; END_NAMESPACE // mw