@@ -283,22 +283,26 @@ error::error_t CLASS::spent_prevout(const point_link& link, index index,
283283 // The upside is half the prevout size (read/write/page) and store increase.
284284
285285 // Iterate points by point hash (of output tx) because may be conflicts.
286- auto point = store_.point .it (get_point_key (link));
286+ // Search key must be passed as an l-value as it is held by reference.
287+ const auto point_sk = get_point_key (link);
288+ auto point = store_.point .it (point_sk);
287289 if (!point)
288- return error::integrity1 ;
290+ return error::integrity ;
289291
290292 do
291293 {
292294 // Iterate all spends of the point to find double spends.
293- auto it = store_.spend .it (table::spend::compose (point.self (), index));
295+ // Search key must be passed as an l-value as it is held by reference.
296+ const auto spend_sk = table::spend::compose (point.self (), index);
297+ auto it = store_.spend .it (spend_sk);
294298 if (!it)
295299 return error::success;
296300
297301 table::spend::get_parent spend{};
298302 do
299303 {
300304 if (!store_.spend .get (it, spend))
301- return error::integrity2 ;
305+ return error::integrity ;
302306
303307 // is_strong_tx (search) only called in the case of duplicate.
304308 // Other parent tx of spend is strong (confirmed spent prevout).
@@ -359,7 +363,7 @@ error::error_t CLASS::unspendable_prevout(uint32_t sequence, bool coinbase,
359363
360364 context out{};
361365 if (!get_context (out, block))
362- return error::integrity3 ;
366+ return error::integrity ;
363367
364368 // All txs with same hash must be coinbase or not.
365369 if (coinbase && !transaction::is_coinbase_mature (out.height , ctx.height ))
@@ -494,12 +498,14 @@ spend_sets CLASS::to_spend_sets(const header_link& link) const NOEXCEPT
494498 // Coinbase tx does not spend so is not retrieved.
495499 const auto txs = to_spending_transactions (link);
496500
501+ // Empty here is normal.
497502 if (txs.empty ())
498503 return {};
499504
500505 spend_sets sets{ txs.size () };
501506 const auto to_set = [this ](const auto & tx) NOEXCEPT
502507 {
508+ // Empty here implies integrity fault.
503509 return to_spend_set (tx);
504510 };
505511
@@ -533,13 +539,14 @@ code CLASS::block_confirmable(const header_link& link) const NOEXCEPT
533539{
534540 context ctx{};
535541 if (!get_context (ctx, link))
536- return error::integrity4 ;
542+ return error::integrity ;
537543
538544 // This is never invoked (bip30).
539545 code ec{};
540546 if ((ec = unspent_duplicates (link, ctx)))
541547 return ec;
542548
549+ // Empty here could imply integrity fault.
543550 const auto sets = to_spend_sets (link);
544551 if (sets.empty ())
545552 return ec;
@@ -753,6 +760,8 @@ bool CLASS::initialize(const block& genesis) NOEXCEPT
753760 BC_ASSERT (!is_initialized ());
754761 BC_ASSERT (is_one (genesis.transactions_ptr ()->size ()));
755762
763+ // TODO: add genesis block neutrino head and body when neutrino is enabled.
764+
756765 // ========================================================================
757766 const auto scope = store_.get_transactor ();
758767
0 commit comments