Friday, November 22, 2024

How does bitcoin core deal with service flag spoofing?

There are 5 service flags in src/protocol.cpp:

static std::string serviceFlagToStr(size_t bit)
{
    const uint64_t service_flag = 1ULL << bit;
    change ((ServiceFlags)service_flag) {
    case NODE_NONE: abort();  // inconceivable
    case NODE_NETWORK:         return "NETWORK";
    case NODE_BLOOM:           return "BLOOM";
    case NODE_WITNESS:         return "WITNESS";
    case NODE_COMPACT_FILTERS: return "COMPACT_FILTERS";
    case NODE_NETWORK_LIMITED: return "NETWORK_LIMITED";
    // Not utilizing default, so we get warned when a case is lacking
    }
/** nServices flags */
enum ServiceFlags : uint64_t {
    // NOTE: When including right here, remember to replace serviceFlagToStr too
    // Nothing
    NODE_NONE = 0,
    // NODE_NETWORK signifies that the node is able to serving the entire block chain. It's presently
    // set by all Bitcoin Core non pruned nodes, and is unset by SPV purchasers or different gentle purchasers.
    NODE_NETWORK = (1 << 0),
    // NODE_BLOOM means the node is succesful and prepared to deal with bloom-filtered connections.
    // Bitcoin Core nodes used to help this by default, with out promoting this bit,
    // however not do as of protocol model 70011 (= NO_BLOOM_VERSION)
    NODE_BLOOM = (1 << 2),
    // NODE_WITNESS signifies {that a} node could be requested for blocks and transactions together with
    // witness knowledge.
    NODE_WITNESS = (1 << 3),
    // NODE_COMPACT_FILTERS means the node will service primary block filter requests.
    // See BIP157 and BIP158 for particulars on how that is carried out.
    NODE_COMPACT_FILTERS = (1 << 6),
    // NODE_NETWORK_LIMITED means the identical as NODE_NETWORK with the limitation of solely
    // serving the final 288 (2 day) blocks
    // See BIP159 for particulars on how that is carried out.
    NODE_NETWORK_LIMITED = (1 << 10),

Do bitcoin core nodes confirm if a peer is bluffing a couple of service flag? Instance: If a peer has NODE_NETWORK flag set however its a pruned node

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles