Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reenable tx_confirmable. #503

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading