Skip to content

Improve ConnectionKind enums; #623

@qlrd

Description

@qlrd

Our current ConnectionKind enum isn't compliant with core, as stated in #622.

Core define some connection types:

"connection_type" : "str",            (string) Type of connection: 
                                      outbound-full-relay (default automatic connections),
                                      block-relay-only (does not relay transactions or addresses),
                                      inbound (initiated by the peer),
                                      manual (added via addnode RPC or -addnode/-connect configuration options),
                                      addr-fetch (short-lived automatic connection for soliciting addresses),
                                      feeler (short-lived automatic connection for testing addresses).

A important warning is:

Please note this output is unlikely to be stable in upcoming releases as we iterate to best capture connection behaviors.

IMO, it's worth to change to something like this, changing Regular and Extra to more defined ones:

#[derive(Debug, PartialEq, Clone, Copy)]
/// Type of connection. 
pub enum ConnectionKind {
    /// Old Regular type: default automatic connections.
    OutboundFullRelay(ServiceFlags),

    /// Old extra type: Does not relay transactions or addresses
    BlockRelayOnly(ServiceFlags),

    /// Old extra type: Initiated by the peer
    Inbound(ServiceFlags),

    /// Old extra type: added via addnode RPC or -addnode/-connect configuration options
    Manual(ServiceFlags),

    /// Old feeler addresses (?): Short-lived automatic connection for soliciting addresses
    AddrFetch,

    /// Short-lived automatic connection for testing addresses
    Feeler,
}

But idk if this is tottally possible or what is possible in our current implementation. So it will be nice to hear the options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    compatibilityreliabilityRelated to runtime reliability, stability and production readiness

    Type

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions