Ok, I see the problem now. We're computing candidate priority from the candidate's base, but when a relay candidate finishes allocating, it's base becomes the external IP address of the TURN server, transforming it into a UDP base, which upsets the priority (and results in the duplicate). This shouldn't be a super difficult fix.
Bug 1964973 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Ok, I see the problem now. We're computing candidate priority from the candidate's base, but when a relay candidate finishes allocating, its base becomes the external IP address of the TURN server, transforming it into a UDP base, which upsets the priority (and results in the duplicate). This shouldn't be a super difficult fix.