View in context in the libbitcoin Slack #general mirror.
skips all validation
once the best headers chain tip is current
When received, all checks which don't require strict ordering are performed and transactions are stored in a global transaction index.
// Header state is checked by organize.
code protocol_block_in_31800::check(const chain::block& block,
const chain::context& ctx, bool bypass) const NOEXCEPT
{
code ec{};
if (bypass)
{
// Only identity is required under bypass.
if (((ec = block.identify())) || ((ec = block.identify(ctx))))
return ec;
}
else
{
// Identity is not correct if error::invalid_transaction_commitment.
if ((ec = block.check()))
{
if ((ec != system::error::invalid_transaction_commitment) &&
block.is_malleated())
return system::error::block_malleated;
return ec;
}
if ((ec = block.check(ctx)))
return ec;
}
return system::error::block_success;
} (edited)The fully validated chain is then persisted
There is a "spender" relation between an output and its spending transaction(s).
There is a "confirmed" relation between a transaction and its confirmation height
When checking a block for confirmability it will for every transaction fetch its prevout transaction(s) (which must have confirmed state, otherwise the block confirmability check fails) and for each prevout it will mark the spender corresponding to the transaction being checked for confirmability as "confirmed" (if there exists any other spender whose related transaction is "confirmed", this is a double spend, the block confirmability check fails).
wouldn't be able to reorg past the pruning point.
The transaction table is also used to persist unconfirmed transactions.
by default the node requires a transaction has at least 1sat/vb.
For conflicts the node requires the transaction pays at least the minimum feerate for itself plus for the whole graph it conflicts with, plus an incremental feerate (1sat/vb too by default).
timelocks
There is a "confirmed" relation between a transaction and its confirmation height
confirmation header (edited)
validated_tx table with the tx state and validation context. We don't do this during block download because blocks are validated as a whole, so there is no need to relay the transaction state, block state is sufficient for the next (confirmation) checks, which are necessarily block-based. We considered (and designed for) individual transaction-based validation stage fan-out, which could either use this table or synchronize on the block. However, performance testing showed that as long as there are as many blocks as threads it is much faster to validate whole blocks. The same fan-out was tested for confirmability (within a block) and was also found to be not worth the fan-out cost (although was much closer because it's a single block at a time, and there may be configurations where it makes sense). And the tx validation entries are not necessary apart from validating the chain (the plan was to purge the file periodically). So this will probably end up being used only for transactions that enter via the pool. However validated_bk is written with current state (no context required, as block context is inherent and stored with the header), which allows the confirmation chaser to proceed across validated blocks (changing them to confirmable or unconfirmable. A confirmable block may cycle between confirmed and unconfirmed, but the confirmability state is final.validated_bk data is also designed so that it may be purged (it would just have to be regenerated if the block returned via a re-reorg, which would happen automatically. But there are so few blocks and these entries are small (no context) that it's not really worth automating it.