Skip to content

Commit

Permalink
Merge pull request #1607 from evoskuil/master
Browse files Browse the repository at this point in the history
Add spender to prevout metadata.
  • Loading branch information
evoskuil authored Feb 15, 2025
2 parents 4bf2133 + d690e55 commit 54d135f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/bitcoin/system/chain/input.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class BC_API input
/// Public mutable metadata access, copied but not compared for equality.
/// Defaults are set so non-population issues usually imply invalidity.
mutable chain::output::cptr prevout{};
mutable chain::prevout metadata{ zero, max_uint32, true, true };
mutable chain::prevout metadata{ zero, max_uint32, true, true, true };
};

typedef std_vector<input> inputs;
Expand Down
18 changes: 10 additions & 8 deletions include/bitcoin/system/chain/prevout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ class BC_API prevout final
{
/// The confirmed chain height of the prevout (zero if not found).
/// Unused if the input owning this prevout is null (coinbase).
size_t height;
size_t height{ zero };

/// node: populated with a database identifier for the parent tx.
uint32_t parent{ zero };
/// node: populated with database identifier for prevout's parent tx.
uint32_t parent;
};

///************************************************************************
Expand All @@ -51,13 +51,10 @@ class BC_API prevout final
{
/// The median time past at height (max_uint32 if not found/confirmed).
/// Unused if the input owning this prevout is null (coinbase).
/// node: unused as validation precedes prevout block association.
uint32_t median_time_past{ max_uint32 };

/// node: set via block.populate() as internal spends do not
/// require prevout block association for relative locktime checks.
/// So median_time_past is not required as locked is determined here.
bool locked;
/// node: populated with database identifier for spender's parent tx.
uint32_t spender;
};

///************************************************************************
Expand All @@ -77,6 +74,11 @@ class BC_API prevout final
bool inside;
};

/// node: set via block.populate() as internal spends do not
/// require prevout block association for relative locktime checks.
/// So median_time_past is not required as locked is determined here.
bool locked{ true };

/// The previous output is of a coinbase transaction.
/// node: populated, does not require prevout block association.
bool coinbase{ true };
Expand Down

0 comments on commit 54d135f

Please # to comment.