Skip to content

Commit

Permalink
Merge pull request #1426 from evoskuil/master
Browse files Browse the repository at this point in the history
Comments.
  • Loading branch information
evoskuil authored Mar 23, 2024
2 parents 8752f19 + 19336b1 commit e6928fa
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/bitcoin/system/chain/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace chain {
class BC_API context final
{
public:
/// Determine if the fork is ative for this block.
/// Determine if the fork is active for this block.
bool is_enabled(chain::forks fork) const NOEXCEPT;

/// Header context within chain.
Expand Down
12 changes: 12 additions & 0 deletions src/chain/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,11 @@ code block::check() const NOEXCEPT
return check_transactions();
}

// forks
// height
// timestamp
// median_time_past

code block::check(const context& ctx) const NOEXCEPT
{
const auto bip34 = ctx.is_enabled(bip34_rule);
Expand All @@ -705,6 +710,9 @@ code block::check(const context& ctx) const NOEXCEPT
return check_transactions(ctx);
}

// forks
// height

// This assumes that prevout caching is completed on all inputs.
code block::accept(const context& ctx, size_t subsidy_interval,
uint64_t initial_subsidy) const NOEXCEPT
Expand All @@ -722,6 +730,8 @@ code block::accept(const context& ctx, size_t subsidy_interval,
return accept_transactions(ctx);
}

// forks

// Node performs these checks through database query.
// This assumes that prevout and metadata caching are completed on all inputs.
code block::confirm(const context& ctx) const NOEXCEPT
Expand All @@ -734,6 +744,8 @@ code block::confirm(const context& ctx) const NOEXCEPT
return confirm_transactions(ctx);
}

// forks

code block::connect(const context& ctx) const NOEXCEPT
{
return connect_transactions(ctx);
Expand Down
4 changes: 4 additions & 0 deletions src/chain/header.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ code header::check(uint32_t timestamp_limit_seconds,
return error::success;
}

// minimum_block_version
// median_time_past
// work_required

// Checkpoints and previous_block_hash are chain validation (not here).
// bits_ below is the consensus direct comparison of the header.bits value.
// All other work comparisons performed on expanded/normalized bits values.
Expand Down
11 changes: 11 additions & 0 deletions src/chain/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,11 @@ code transaction::check() const NOEXCEPT
return error::transaction_success;
}

// forks
// height
// timestamp
// median_time_past

// DO invoke on coinbase.
code transaction::check(const context& ctx) const NOEXCEPT
{
Expand Down Expand Up @@ -1282,6 +1287,10 @@ code transaction::accept(const context&) const NOEXCEPT
return error::transaction_success;
}

// forks
// height
// median_time_past

// Do NOT invoke on coinbase.
// Node performs these checks through database query.
// This assumes that prevout and metadata caching are completed on all inputs.
Expand All @@ -1307,6 +1316,8 @@ code transaction::confirm(const context& ctx) const NOEXCEPT
// Connect (contextual).
// ----------------------------------------------------------------------------

// forks

// Do NOT invoke on coinbase.
code transaction::connect(const context& ctx) const NOEXCEPT
{
Expand Down

0 comments on commit e6928fa

Please sign in to comment.