Inside Bitcoin
Opening the selected file…
Inside Bitcoin
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1501}1503void btck_block_header_destroy(btck_BlockHeader* header)1504{1505delete header;1506}1508btck_ValidationMode btck_tx_validation_state_get_validation_mode(const btck_TxValidationState* state_)1509{1510const auto& state = btck_TxValidationState::get(state_);1511if (state.IsValid()) return btck_ValidationMode_VALID;1512if (state.IsInvalid()) return btck_ValidationMode_INVALID;1513return btck_ValidationMode_INTERNAL_ERROR;1514}1516btck_TxValidationState* btck_tx_validation_state_create()1517{1518return btck_TxValidationState::create();1519}1521btck_TxValidationResult btck_tx_validation_state_get_tx_validation_result(const btck_TxValidationState* state_)1522{1523switch (btck_TxValidationState::get(state_).GetResult()) {1524case TxValidationResult::TX_RESULT_UNSET: return btck_TxValidationResult_UNSET;1525case TxValidationResult::TX_CONSENSUS: return btck_TxValidationResult_CONSENSUS;1526case TxValidationResult::TX_INPUTS_NOT_STANDARD: return btck_TxValidationResult_INPUTS_NOT_STANDARD;1527case TxValidationResult::TX_NOT_STANDARD: return btck_TxValidationResult_NOT_STANDARD;1528case TxValidationResult::TX_MISSING_INPUTS: return btck_TxValidationResult_MISSING_INPUTS;1529case TxValidationResult::TX_PREMATURE_SPEND: return btck_TxValidationResult_PREMATURE_SPEND;1530case TxValidationResult::TX_WITNESS_MUTATED: return btck_TxValidationResult_WITNESS_MUTATED;1531case TxValidationResult::TX_WITNESS_STRIPPED: return btck_TxValidationResult_WITNESS_STRIPPED;1532case TxValidationResult::TX_CONFLICT: return btck_TxValidationResult_CONFLICT;1533case TxValidationResult::TX_MEMPOOL_POLICY: return btck_TxValidationResult_MEMPOOL_POLICY;1534case TxValidationResult::TX_NO_MEMPOOL: return btck_TxValidationResult_NO_MEMPOOL;1535case TxValidationResult::TX_RECONSIDERABLE: return btck_TxValidationResult_RECONSIDERABLE;1536case TxValidationResult::TX_UNKNOWN: return btck_TxValidationResult_UNKNOWN;1537} // no default case, so the compiler can warn about missing cases1538assert(false);1539}1541void btck_tx_validation_state_destroy(btck_TxValidationState* state)1542{1543delete state;1544}1546int btck_transaction_check(const btck_Transaction* tx, btck_TxValidationState* validation_state)1547{1548auto& state = btck_TxValidationState::get(validation_state);1549state = TxValidationState{};1550const bool ok = CheckTransaction(*btck_Transaction::get(tx), state);1551return ok ? 1 : 0;1552}1554int btck_set_mock_time(int64_t timestamp)1555{1556constexpr int64_t max_time{std::numeric_limits<uint32_t>::max()};1557if (timestamp < 0 || timestamp > max_time) {1558return -1;1559}1560SetMockTime(std::chrono::seconds{timestamp});1561return 0;1562}