From cf516020abbf174d5338cd050597423dd1bda446 Mon Sep 17 00:00:00 2001 From: evoskuil Date: Thu, 18 Apr 2024 00:23:20 -0400 Subject: [PATCH] No need to read spend.parent_fk in confirm. --- include/bitcoin/database/impl/query/confirm.ipp | 7 ++----- include/bitcoin/database/tables/indexes/spend.hpp | 5 ++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/include/bitcoin/database/impl/query/confirm.ipp b/include/bitcoin/database/impl/query/confirm.ipp index 10859fd8..c17cbbbc 100644 --- a/include/bitcoin/database/impl/query/confirm.ipp +++ b/include/bitcoin/database/impl/query/confirm.ipp @@ -326,7 +326,7 @@ code CLASS::block_confirmable(const header_link& link) const NOEXCEPT return ec; uint32_t version{}; - table::spend::get_prevout_parent_sequence spend{}; + table::spend::get_prevout_sequence spend{}; for (auto tx = std::next(txs.begin()); tx != txs.end(); ++tx) { for (const auto& spend_fk: to_tx_spends(version, *tx)) @@ -334,9 +334,6 @@ code CLASS::block_confirmable(const header_link& link) const NOEXCEPT if (!store_.spend.get(spend_fk, spend)) return error::integrity; - // TODO: don't read spend.parent_fk. - BC_ASSERT(spend.parent_fk == *tx); - if ((ec = spendable_prevout(spend.point_fk, spend.sequence, version, ctx))) return ec; @@ -510,7 +507,7 @@ bool CLASS::pop_confirmed() NOEXCEPT //// if (!get_context(ctx, link)) //// return false; //// -//// table::input::get_prevout_parent_sequence input{}; +//// table::input::get_prevout_sequence input{}; //// for (const auto& in: to_non_coinbase_inputs(link)) //// { //// if (!store_.input.get(in, input)) diff --git a/include/bitcoin/database/tables/indexes/spend.hpp b/include/bitcoin/database/tables/indexes/spend.hpp index 6e78b323..f81512e3 100644 --- a/include/bitcoin/database/tables/indexes/spend.hpp +++ b/include/bitcoin/database/tables/indexes/spend.hpp @@ -219,7 +219,7 @@ struct spend tx::integer parent_fk{}; }; - struct get_prevout_parent_sequence + struct get_prevout_sequence : public schema::spend { inline bool from_data(reader& source) NOEXCEPT @@ -231,7 +231,7 @@ struct spend if (null_point(point_fk)) point_index = system::chain::point::null_index; - parent_fk = source.read_little_endian(); + source.skip_bytes(tx::size); sequence = source.read_little_endian(); return source; } @@ -248,7 +248,6 @@ struct spend pt::integer point_fk{}; ix::integer point_index{}; - tx::integer parent_fk{}; uint32_t sequence{}; };