hsd icon indicating copy to clipboard operation
hsd copied to clipboard

Prevent multiple connections to the same peer

Open pinheadmz opened this issue 5 years ago • 1 comments

Not sure if this is a clearnet/brontide issue or peers are just connecting to each other redundantly, but I have a node that has two connections from easyhandshake, one inbound and one outbound:

  {
    "id": 182,
    "addr": "165.22.151.242:43298",
    "addrlocal": "64.227.15.172:12038",
    "services": "00000003",
    "servicenames": [
      "NETWORK",
      "BLOOM"
    ],
    "relaytxes": true,
    "lastsend": 1597955469,
    "lastrecv": 1597955469,
    "bytessent": 888009,
    "bytesrecv": 926672,
    "conntime": 277062,
    "timeoffset": -42,
    "pingtime": 0.076,
    "minping": 0.065,
    "version": 3,
    "subver": "/hsd:2.2.0/easyhandshake.com/",
    "inbound": true,
    "startingheight": 28849,
    "besthash": "000000000000000a2e717f876657fd7bfaa54cb3c2ae86d76c18b5bf44fcafac",
    "bestheight": 29301,
    "banscore": 0,
    "inflight": [],
    "whitelisted": false
  },
  {
    "id": 199,
    "addr": "165.22.151.242:12038",
    "addrlocal": "64.227.15.172:49104",
    "services": "00000003",
    "servicenames": [
      "NETWORK",
      "BLOOM"
    ],
    "relaytxes": true,
    "lastsend": 1597955465,
    "lastrecv": 1597955465,
    "bytessent": 903240,
    "bytesrecv": 886301,
    "conntime": 277036,
    "timeoffset": -16,
    "pingtime": 0.077,
    "minping": 0.067,
    "version": 3,
    "subver": "/hsd:2.2.0/easyhandshake.com/",
    "inbound": false,
    "startingheight": 28849,
    "besthash": "000000000000000a2e717f876657fd7bfaa54cb3c2ae86d76c18b5bf44fcafac",
    "bestheight": 29301,
    "banscore": 0,
    "inflight": [],
    "whitelisted": false
  },

pinheadmz avatar Aug 20 '20 20:08 pinheadmz

This should definitely be linked to https://github.com/handshake-org/hsd/issues/487

Maybe the behavior is like this:

Every time we connect to a node and complete the handshake on either channel, check if we are connected on both channels to the same IP:port and if so, drop the clearnet connection and remove the clearnet hostname from address manager, favoring the brontide connection.

pinheadmz avatar Mar 13 '21 15:03 pinheadmz