File tree Expand file tree Collapse file tree
include/bitcoin/system/chain Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ class BC_API block
137137 code confirm (const context& ctx) const NOEXCEPT;
138138
139139 // / Populate previous outputs (only, no metadata) internal to the block.
140- void populate () const NOEXCEPT;
140+ size_t populate () const NOEXCEPT;
141141
142142protected:
143143 block (const chain::header::cptr& header,
Original file line number Diff line number Diff line change @@ -688,7 +688,7 @@ bool block::is_unspent_coinbase_collision() const NOEXCEPT
688688}
689689
690690// Search is not ordered, forward references are caught by block.check.
691- void block::populate () const NOEXCEPT
691+ size_t block::populate () const NOEXCEPT
692692{
693693 std::unordered_map<point, output::cptr> points{};
694694 uint32_t index{};
@@ -699,16 +699,22 @@ void block::populate() const NOEXCEPT
699699 points.emplace (std::pair{ point{ (*tx)->hash (false ), index++ },
700700 out });
701701
702- // Populate input prevouts from hash table.
702+ // Populate input prevouts from hash table and obtain count.
703+ size_t count{};
703704 for (auto tx = txs_->begin (); tx != txs_->end (); ++tx)
704705 {
705706 for (const auto & in: *(*tx)->inputs_ptr ())
706707 {
707708 const auto point = points.find (in->point ());
708709 if (point != points.end ())
710+ {
711+ ++count;
709712 in->prevout = point->second ;
713+ }
710714 }
711715 }
716+
717+ return count;
712718}
713719
714720// Delegated.
You can’t perform that action at this time.
0 commit comments