@@ -738,10 +738,10 @@ void block::populate() const NOEXCEPT
738738 }
739739}
740740
741- bool block::populate_with_metadata (const chain::context& ctx) const NOEXCEPT
741+ code block::populate_with_metadata (const chain::context& ctx) const NOEXCEPT
742742{
743743 if (txs_->empty ())
744- return true ;
744+ return error::block_success ;
745745
746746 const auto bip68 = ctx.is_enabled (chain::flags::bip68_rule);
747747 unordered_map_of_cref_point_to_output_cptr_cref points{ outputs () };
@@ -753,7 +753,6 @@ bool block::populate_with_metadata(const chain::context& ctx) const NOEXCEPT
753753 points.emplace (cref_point{ (*tx)->get_hash (false ), index++ }, out);
754754
755755 // Populate input prevouts from hash table and obtain maturity.
756- auto locked = false ;
757756 for (auto tx = std::next (txs_->begin ()); tx != txs_->end (); ++tx)
758757 {
759758 for (const auto & in: *(*tx)->inputs_ptr ())
@@ -765,18 +764,22 @@ bool block::populate_with_metadata(const chain::context& ctx) const NOEXCEPT
765764 if (point != points.end ())
766765 {
767766 // Zero maturity coinbase spend is immature.
768- const auto lock = (bip68 && (*tx)->is_internal_lock (*in));
767+ const auto lock = (bip68 && (*tx)->is_internally_locked (*in));
769768 const auto immature = !is_zero (coinbase_maturity) &&
770769 (in->point ().hash () == txs_->front ()->get_hash (false ));
771770
772771 in->prevout = point->second ;
773- in->metadata .locked = immature || lock;
774- locked |= in->metadata .locked ;
772+ if ((in->metadata .locked = (immature || lock)))
773+ {
774+ // Shortcircuit population and return above error.
775+ return immature ? error::coinbase_maturity :
776+ error::relative_time_locked;
777+ }
775778 }
776779 }
777780 }
778781
779- return !locked ;
782+ return error::block_success ;
780783}
781784
782785// Delegated.
0 commit comments