fix: removed dummy ID(b) from upgrade_security for inbound connections (#681)

* fix: removed dummy ID(b) from upgrade_security for inbound connections

* added newsfragment

* updated newsfragment
This commit is contained in:
Abhinav Agarwalla
2025-06-17 17:55:50 +05:30
committed by GitHub
parent d61bca78ab
commit 2ed2587fc9
3 changed files with 10 additions and 6 deletions

View File

@ -187,7 +187,7 @@ class Swarm(Service, INetworkService):
# Per, https://discuss.libp2p.io/t/multistream-security/130, we first secure
# the conn and then mux the conn
try:
secured_conn = await self.upgrader.upgrade_security(raw_conn, peer_id, True)
secured_conn = await self.upgrader.upgrade_security(raw_conn, True, peer_id)
except SecurityUpgradeFailure as error:
logger.debug("failed to upgrade security for peer %s", peer_id)
await raw_conn.close()
@ -257,10 +257,7 @@ class Swarm(Service, INetworkService):
# Per, https://discuss.libp2p.io/t/multistream-security/130, we first
# secure the conn and then mux the conn
try:
# FIXME: This dummy `ID(b"")` for the remote peer is useless.
secured_conn = await self.upgrader.upgrade_security(
raw_conn, ID(b""), False
)
secured_conn = await self.upgrader.upgrade_security(raw_conn, False)
except SecurityUpgradeFailure as error:
logger.debug("failed to upgrade security for peer at %s", maddr)
await raw_conn.close()