STP - connecting one port to another port on the same switch

In the event that you connect one switchport to another switchport on the same switch, STP will still choose a port to put into the blocked port role based on the Port ID. This is a special case of the determination f the blocked port using the Port ID.

In such a case, regardless of whether or not the switch is the root bridge, all of the same criteria will be checked. Because both ports are on the same switch, both ports are considered receiving and sending ports. So ultimately, it is the port with the highest port ID that will be blocked.

Links:

https://forum.networklessons.com/t/spanning-tree-reconvergence/1346/33?u=lagapidis

https://networklessons.com/cisco/ccie-routing-switching-written/spanning-tree-cost-calculation

https://networklessons.com/cisco/ccie-routing-switching-written/spanning-tree-reconvergence