Источник / закреплённая редакция

Bitcoin Core v27.2 consensus and validation source files

Источник пакета btc.consensus · v27.2 / cca564adfa35f10a50d314f94b9ee421cac7e593

work
urn:btc:clir:consensus#BITCOIN_CORE_V27_2
номер
v27.2 / cca564adfa35f10a50d314f94b9ee421cac7e593
вид
urn:btc:clir:consensus#code

src/consensus/amount.h

edition
urn:btc:clir:consensus#CORE_AMOUNT_H
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/amount.htext/plain; charset=utf-8sha256:cb7bd951877f3fea5a0c280d4bb907a8403437add81e3d5b898879b78fdc877e2026-08-31T00:00:00Z

Фрагменты — 0

src/consensus/consensus.h

edition
urn:btc:clir:consensus#CORE_CONSENSUS_H
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/consensus.htext/plain; charset=utf-8sha256:8190d21007fa10727e54a4cb75355deeb1c30a0c6984986e93cba87564772a612026-08-31T00:00:00Z

Фрагменты — 1

src/consensus/consensus.h:18-19 · section · на него ссылаются: 7

en · official · sha256:e72b860e7b112c3564a5fc011d1f341a2b4034629f9322c2f8bb4bb9a6b91ed4EN

/** Coinbase transaction outputs can only be spent after this number of new blocks (network rule) */ static const int COINBASE_MATURITY = 100;

Ссылаются нормы: CoinbaseInputMaturesAfterOneHundredNewBlocks, Output, all_coinbase_inputs_mature, coinbase_input_mature, coinbase_output_height, input_spends_coinbase_output, spending_block_height

src/consensus/merkle.cpp

edition
urn:btc:clir:consensus#CORE_MERKLE_CPP
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/merkle.cpptext/plain; charset=utf-8sha256:69e5bebee3d98f4ef711c1970d5814950310c4d6e5ee524625570354df0d18ad2026-08-31T00:00:00Z

Фрагменты — 0

src/consensus/merkle.h

edition
urn:btc:clir:consensus#CORE_MERKLE_H
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/merkle.htext/plain; charset=utf-8sha256:cda707c52f83afb4332862e6aefc66410027b71a7920d3afd9d74399dea1242e2026-08-31T00:00:00Z

Фрагменты — 0

src/consensus/params.h

edition
urn:btc:clir:consensus#CORE_PARAMS_H
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/params.htext/plain; charset=utf-8sha256:b7d5f2f71ce5531a7d13ee641290e0f382655a9db8bae6cc1c6de629638598272026-08-31T00:00:00Z

Фрагменты — 0

src/pow.cpp

edition
urn:btc:clir:consensus#CORE_POW_CPP
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/pow.cpptext/plain; charset=utf-8sha256:a997ebc9e89ec0ed0f98fe56e7ece7c0a799746d36be5c0951ca6fd264280a332026-08-31T00:00:00Z

Фрагменты — 3

src/pow.cpp:125-141 · section · на него ссылаются: 4

en · official · sha256:14f6d6f0b58567cd182072995ba4d02ba988aca87c5d024a59664f6c4e3e5fb3EN

bool CheckProofOfWork(uint256 hash, unsigned int nBits, const Consensus::Params& params) { bool fNegative; bool fOverflow; arith_uint256 bnTarget; bnTarget.SetCompact(nBits, &fNegative, &fOverflow); // Check range if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit)) return false; // Check proof of work matches claimed amount if (UintToArith256(hash) > bnTarget) return false; return true;

Ссылаются нормы: Block, HeaderIsValidInNarrowSlice, proof_of_work_threshold_satisfied, retarget_target_matches_core_256bit_arithmetic

src/pow.cpp:18-20 · section · на него ссылаются: 8

en · official · sha256:2c9d7b9fefc0e8afd4ce76bce6a5af6b524ce2d14753ac08c2a5da68d23df01bEN

// Only change once per difficulty adjustment interval if ((pindexLast->nHeight+1) % params.DifficultyAdjustmentInterval() != 0) {

Ссылаются нормы: Block, HeaderIsValidInNarrowSlice, KeepDifficultyOutsideBoundary, RetargetAt2016With2015Intervals, header_candidate, header_height, inherited_prior_bits, retarget_boundary_2016

src/pow.cpp:40-43 · section · на него ссылаются: 2

en · official · sha256:3f3b9b5de3730daf7f348d74d85c32f6935f1fedbc63fbef5714edd83307456fEN

// Go back by what we want to be 14 days worth of blocks int nHeightFirst = pindexLast->nHeight - (params.DifficultyAdjustmentInterval()-1); assert(nHeightFirst >= 0); const CBlockIndex* pindexFirst = pindexLast->GetAncestor(nHeightFirst);

Ссылаются нормы: RetargetAt2016With2015Intervals, retarget_uses_2015_elapsed_intervals

src/consensus/tx_check.cpp

edition
urn:btc:clir:consensus#CORE_TX_CHECK_CPP
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/tx_check.cpptext/plain; charset=utf-8sha256:495df9a5b341bb22a3651e5738b6628253c6b6f1fbef804213be2310eec7bf952026-08-31T00:00:00Z

Фрагменты — 0

src/consensus/tx_check.h

edition
urn:btc:clir:consensus#CORE_TX_CHECK_H
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/tx_check.htext/plain; charset=utf-8sha256:23706ad3084790cf1f3df4917664377c1e5d55e2d9e26d952201ad93f69b3faf2026-08-31T00:00:00Z

Фрагменты — 0

src/consensus/tx_verify.cpp

edition
urn:btc:clir:consensus#CORE_TX_VERIFY_CPP
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/tx_verify.cpptext/plain; charset=utf-8sha256:833e51a12449f40e341684c04e9fa0e89e4b76645d319487903bc8e4e87f0f392026-08-31T00:00:00Z

Фрагменты — 3

src/consensus/tx_verify.cpp:51-60 · section · на него ссылаются: 1

en · official · sha256:cc9e94b779e8d00b807b905913e3e927c46022b9108ee1ea99f90323876e717cEN

// tx.nVersion is signed integer so requires cast to unsigned otherwise // we would be doing a signed comparison and half the range of nVersion // wouldn't support BIP 68. bool fEnforceBIP68 = static_cast<uint32_t>(tx.nVersion) >= 2 && flags & LOCKTIME_VERIFY_SEQUENCE; // Do not enforce sequence numbers as a relative lock time // unless we have been instructed to if (!fEnforceBIP68) { return std::make_pair(nMinHeight, nMinTime);

Ссылаются нормы: relative_lock_kind

src/consensus/tx_verify.cpp:66-108 · section · на него ссылаются: 9

en · official · sha256:19af2d3d3ed4cfc23926fe0bd3a3951192d7e9f708fc95e311ac81ee498b8082EN

// Sequence numbers with the most significant bit set are not // treated as relative lock-times, nor are they given any // consensus-enforced meaning at this point. if (txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_DISABLE_FLAG) { // The height of this input is not relevant for sequence locks prevHeights[txinIndex] = 0; continue; } int nCoinHeight = prevHeights[txinIndex]; if (txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_TYPE_FLAG) { const int64_t nCoinTime{Assert(block.GetAncestor(std::max(nCoinHeight - 1, 0)))->GetMedianTimePast()}; // NOTE: Subtract 1 to maintain nLockTime semantics // BIP 68 relative lock times have the semantics of calculating // the first block or time at which the transaction would be // valid. When calculating the effective block time or height // for the entire transaction, we switch to using the // semantics of nLockTime which is the last invalid block // time or height. Thus we subtract 1 from the calculated // time or height. // Time-based relative lock-times are measured from the // smallest allowed timestamp of the block containing the // txout being spent, which is the median time past of the // block prior. nMinTime = std::max(nMinTime, nCoinTime + (int64_t)((txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_MASK) << CTxIn::SEQUENCE_LOCKTIME_GRANULARITY) - 1); } else { nMinHeight = std::max(nMinHeight, nCoinHeight + (int)(txin.nSequence & CTxIn::SEQUENCE_LOCKTIME_MASK) - 1); } } return std::make_pair(nMinHeight, nMinTime); } bool EvaluateSequenceLocks(const CBlockIndex& block, std::pair<int, int64_t> lockPair) { assert(block.pprev); int64_t nBlockTime = block.pprev->GetMedianTimePast(); if (lockPair.first >= block.nHeight || lockPair.second >= nBlockTime) return false; return true;

Ссылаются нормы: BlockRelativeLockMaturesAtRequiredHeight, DisabledSequenceHasNoRelativeLock, TimeRelativeLockMaturesAtRequiredMtp, Transaction, output_confirmation_height, output_previous_block_mtp, relative_lock_kind, relative_lock_satisfied, relative_lock_value

src/consensus/tx_verify.cpp:17-36 · section · на него ссылаются: 13

en · official · sha256:d1e7316f16be1f9c6140cb10486627826f5b4033e21e097b105807b510e95f59EN

bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) { if (tx.nLockTime == 0) return true; if ((int64_t)tx.nLockTime < ((int64_t)tx.nLockTime < LOCKTIME_THRESHOLD ? (int64_t)nBlockHeight : nBlockTime)) return true; // Even if tx.nLockTime isn't satisfied by nBlockHeight/nBlockTime, a // transaction is still considered final if all inputs' nSequence == // SEQUENCE_FINAL (0xffffffff), in which case nLockTime is ignored. // // Because of this behavior OP_CHECKLOCKTIMEVERIFY/CheckLockTime() will // also check that the spending input's nSequence != SEQUENCE_FINAL, // ensuring that an unsatisfied nLockTime value will actually cause // IsFinalTx() to return false here: for (const auto& txin : tx.vin) { if (!(txin.nSequence == CTxIn::SEQUENCE_FINAL)) return false; } return true;

Ссылаются нормы: FinalSequencesIgnoreUnsatisfiedLocktime, HeightLocktimeIsStrictlyEarlierThanBlock, TimeLocktimeUsesPreviousMtp, Transaction, TransactionIsValidInNarrowSlice, ZeroLocktimeIsFinal, absolute_locktime_satisfied, all_input_sequences_final, current_block_height_for_tx, nlocktime_height, nlocktime_is_zero, nlocktime_median_time, transaction_valid_in_slice

src/consensus/tx_verify.h

edition
urn:btc:clir:consensus#CORE_TX_VERIFY_H
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/tx_verify.htext/plain; charset=utf-8sha256:d07ba025c42168db746493d472825539e805bc5dcaf5e8121413af697619e9432026-08-31T00:00:00Z

Фрагменты — 0

src/validation.cpp (including GetBlockSubsidy)

edition
urn:btc:clir:consensus#CORE_VALIDATION_CPP
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/validation.cpptext/plain; charset=utf-8sha256:a84ffd1e837112c9e15e2abfd335c9bc92aab566126a0d507b2b02a7a8db6e562026-08-31T00:00:00Z

Фрагменты — 5

src/validation.cpp:3959-3974 · section · на него ссылаются: 3

en · official · sha256:e88fbe1e135b544423843e6676b7b158095436b27506d04a53cfbefe323f6cd9EN

// Enforce BIP113 (Median Time Past). bool enforce_locktime_median_time_past{false}; if (DeploymentActiveAfter(pindexPrev, chainman, Consensus::DEPLOYMENT_CSV)) { assert(pindexPrev != nullptr); enforce_locktime_median_time_past = true; } const int64_t nLockTimeCutoff{enforce_locktime_median_time_past ? pindexPrev->GetMedianTimePast() : block.GetBlockTime()}; // Check that all transactions are finalized for (const auto& tx : block.vtx) { if (!IsFinalTx(*tx, nHeight, nLockTimeCutoff)) { return state.Invalid(BlockValidationResult::BLOCK_CONSENSUS, "bad-txns-nonfinal", "non-final transaction"); }

Ссылаются нормы: TimeLocktimeUsesPreviousMtp, nlocktime_is_zero, previous_block_median_time_for_tx

src/validation.cpp:5935-5939 · section · на него ссылаются: 3

en · official · sha256:19c058a1929a9b4e7c110e056131697af9d434daccfe54a0ea8ac992c35970f5EN

bool IsBIP30Repeat(const CBlockIndex& block_index) { return (block_index.nHeight==91842 && block_index.GetBlockHash() == uint256S("0x00000000000a4d0a398161ffc163c503763b1f4360639393e0e4c8e300e0caec")) || (block_index.nHeight==91880 && block_index.GetBlockHash() == uint256S("0x00000000000743f190a18c5577a3c2d2a1f610ae9601ac046a38084ccb7cd721")); }

Ссылаются нормы: KnownBip30RepeatIsGrandfathered, bip30_repeat_is_grandfathered, historic_bip30_repeat

src/validation.cpp:3160-3165 · section · на него ссылаются: 5

en · official · sha256:95e2b541d320134df0a81fc51fe2c7939e6c1daadb7cf2c9f43c7d12268bc85eEN

} else { PruneBlockIndexCandidates(); if (!pindexOldTip || m_chain.Tip()->nChainWork > pindexOldTip->nChainWork) { // We're in a better position than we were. Return temporarily to release the lock. fContinue = false; break;

Ссылаются нормы: Chain, PreferGreaterCumulativeWork, candidate_chain, chain_preferred_over_by_work, cumulative_chain_work

src/validation.cpp:3929-3932 · section · на него ссылаются: 4

en · official · sha256:a9fbf1fffa7e75b8159dce3e52dba09f78464c395d848b3060463bf6ed492eeaEN

// Check timestamp against prev if (block.GetBlockTime() <= pindexPrev->GetMedianTimePast()) return state.Invalid(BlockValidationResult::BLOCK_INVALID_HEADER, "time-too-old", "block's timestamp is too early");

Ссылаются нормы: Block, HeaderIsValidInNarrowSlice, HeaderTimestampMustExceedMtp, timestamp_strictly_after_median_of_11_predecessors

src/validation.cpp:1691-1702 · section · на него ссылаются: 40

en · official · sha256:555e08999970e00486614a5b78fcd2962f8a46f06e66e6c7c4387ab928f56cf5EN

CAmount GetBlockSubsidy(int nHeight, const Consensus::Params& consensusParams) { int halvings = nHeight / consensusParams.nSubsidyHalvingInterval; // Force block reward to zero when right shift is undefined. if (halvings >= 64) return 0; CAmount nSubsidy = 50 * COIN; // Subsidy is cut in half every 210,000 blocks which will occur approximately every 4 years. nSubsidy >>= halvings; return nSubsidy; }

Ссылаются нормы: ApplyA3SubsidyAtHeaderHeight, DerivedSubsidyTotalNeverExceedsTwentyOneMillion, block_subsidy, block_subsidy_satoshis, subsidy_schedule_total_satoshis, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-00, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-01, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-02, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-03, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-04, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-05, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-06, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-07, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-08, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-09, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-10, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-11, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-12, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-13, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-14, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-15, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-16, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-17, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-18, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-19, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-20, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-21, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-22, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-23, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-24, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-25, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-26, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-27, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-28, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-29, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-30, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-31, urn:btc:clir:consensus:table:subsidy-by-height/row/halving-32, urn:btc:clir:consensus:table:subsidy-by-height/row/pre-genesis, urn:btc:clir:consensus:table:subsidy-by-height/row/zero-after-shift-33

src/consensus/validation.h

edition
urn:btc:clir:consensus#CORE_VALIDATION_H
язык
en
официальность
official
материализация
PINNED_OFFICIAL_BYTES
жизненный цикл
—

Публикации

URIТипdocumentHashПолучено
https://raw.githubusercontent.com/bitcoin/bitcoin/bf03c458e994abab9be85486ed8a6d8813313579/src/consensus/validation.htext/plain; charset=utf-8sha256:64b109eb45ed7f25e0f10ba8911feaa62ada435b67231f4da7c69e0142670c312026-08-31T00:00:00Z

Фрагменты — 0

Хэш рядом с текстом — sha256 его точных байтов. Он и есть проверка того, что показанный текст совпадает с закреплённым в пакете: расхождение роняет статику оракула.