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.
251valid_in_block = True253def get_tx(self):254lotsa_checksigs = CScript([OP_CHECKSIG] * (MAX_STANDARD_TX_SIGOPS + 1))255return create_tx_with_script(256self.spend_tx, 0,257output_script=lotsa_checksigs,258amount=1)261def getDisabledOpcodeTemplate(opcode):262""" Creates disabled opcode tx template class"""263def get_tx(self):264tx = CTransaction()265vin = self.valid_txin266vin.scriptSig = CScript([opcode])267tx.vin.append(vin)268tx.vout.append(CTxOut(1, basic_p2sh))269return tx271return type('DisabledOpcode_' + str(opcode), (BadTxTemplate,), {272'reject_reason': "disabled opcode",273'get_tx': get_tx,274'valid_in_block' : False275})277class NonStandardAndInvalid(BadTxTemplate):278"""A non-standard transaction which is also consensus-invalid should return the first error."""279reject_reason = "mempool-script-verify-flag-failed (Using OP_CODESEPARATOR in non-witness script)"280block_reject_reason = "block-script-verify-flag-failed (OP_RETURN was encountered)"281valid_in_block = False283def get_tx(self):284return create_tx_with_script(285self.spend_tx, 0, script_sig=b'\x00' * 3 + b'\xab\x6a',286amount=(self.spend_avail // 2))288# Disabled opcode tx templates (CVE-2010-5137)289DisabledOpcodeTemplates = [getDisabledOpcodeTemplate(opcode) for opcode in [290OP_CAT,291OP_SUBSTR,292OP_LEFT,293OP_RIGHT,294OP_INVERT,295OP_AND,296OP_OR,297OP_XOR,298OP_2MUL,299OP_2DIV,300OP_MUL,301OP_DIV,302OP_MOD,303OP_LSHIFT,304OP_RSHIFT]]307def iter_all_templates():308"""Iterate through all bad transaction template types."""309return BadTxTemplate.__subclasses__()
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.