Skip to content

Commit

Permalink
Merge pull request #503 from evoskuil/master
Browse files Browse the repository at this point in the history
Reenable tx_confirmable.
  • Loading branch information
evoskuil committed Jun 26, 2024
2 parents f2e99b5 + 8d17e71 commit 34b3e50
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
39 changes: 20 additions & 19 deletions include/bitcoin/database/impl/query/confirm.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,26 @@ code CLASS::block_confirmable(const header_link& link) const NOEXCEPT
return ec;
}

// Used by node for ASIO concurrency by tx.
TEMPLATE
code CLASS::tx_confirmable(const tx_link& link,
const context& ctx) const NOEXCEPT
{
code ec{};
const auto set = to_spend_set(link);
for (const auto& spend: set.spends)
{
if ((ec = unspendable_prevout(spend.point_fk, spend.sequence,
set.version, ctx)))
return ec;

if (is_spent_prevout(spend.prevout(), link))
return error::confirmed_double_spend;
}

return error::success;
}

#if defined(UNDEFINED)

// protected
Expand All @@ -426,25 +446,6 @@ spend_sets CLASS::to_spend_sets(
return sets;
}

TEMPLATE
code CLASS::tx_confirmable(const tx_link& link,
const context& ctx) const NOEXCEPT
{
code ec{};
const auto set = to_spend_set(link);
for (const auto& spend : set.spends)
{
if ((ec = unspendable_prevout(spend.point_fk, spend.sequence,
set.version, ctx)))
return ec;

if (is_spent_prevout(spend.prevout(), link))
return error::confirmed_double_spend;
}

return error::success;
}

// split(0) 403 secs for 400k-410k
TEMPLATE
code CLASS::block_confirmable(const header_link& link) const NOEXCEPT
Expand Down
2 changes: 0 additions & 2 deletions include/bitcoin/database/query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,7 @@ class query
bool set_strong_parallel(const header_link& link) NOEXCEPT;
bool set_unstrong_parallel(const header_link& link) NOEXCEPT;
code block_confirmable(const header_link& link) const NOEXCEPT;
#if defined(UNDEFINED)
code tx_confirmable(const tx_link& link, const context& ctx) const NOEXCEPT;
#endif
code unspent_duplicates(const tx_link& coinbase,
const context& ctx) const NOEXCEPT;

Expand Down

0 comments on commit 34b3e50

Please sign in to comment.