Inside Bitcoin
Opening the selected file…
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.
501MSG_WTX = 5, //!< Defined in BIP 339502// The following can only occur in getdata. Invs always use TX/WTX or BLOCK.503MSG_FILTERED_BLOCK = 3, //!< Defined in BIP37504MSG_CMPCT_BLOCK = 4, //!< Defined in BIP152505MSG_WITNESS_BLOCK = MSG_BLOCK | MSG_WITNESS_FLAG, //!< Defined in BIP144506MSG_WITNESS_TX = MSG_TX | MSG_WITNESS_FLAG, //!< Defined in BIP144507// MSG_FILTERED_WITNESS_BLOCK is defined in BIP144 as reserved for future508// use and remains unused.509// MSG_FILTERED_WITNESS_BLOCK = MSG_FILTERED_BLOCK | MSG_WITNESS_FLAG,510};512/** inv message data */513class CInv514{515public:516CInv();517CInv(uint32_t typeIn, const uint256& hashIn);519SERIALIZE_METHODS(CInv, obj) { READWRITE(obj.type, obj.hash); }521friend bool operator<(const CInv& a, const CInv& b);523std::string GetMessageType() const;524std::string ToString() const;526// Single-message helper methods527bool IsMsgTx() const { return type == MSG_TX; }528bool IsMsgBlk() const { return type == MSG_BLOCK; }529bool IsMsgWtx() const { return type == MSG_WTX; }530bool IsMsgFilteredBlk() const { return type == MSG_FILTERED_BLOCK; }531bool IsMsgCmpctBlk() const { return type == MSG_CMPCT_BLOCK; }532bool IsMsgWitnessBlk() const { return type == MSG_WITNESS_BLOCK; }534// Combined-message helper methods535bool IsGenTxMsg() const536{537return type == MSG_TX || type == MSG_WTX || type == MSG_WITNESS_TX;538}539bool IsGenBlkMsg() const540{541return type == MSG_BLOCK || type == MSG_FILTERED_BLOCK || type == MSG_CMPCT_BLOCK || type == MSG_WITNESS_BLOCK;542}544uint32_t type;545uint256 hash;546};548/** Convert a TX/WITNESS_TX/WTX CInv to a GenTxid. */549GenTxid ToGenTxid(const CInv& inv);551#endif // BITCOIN_PROTOCOL_H