This seemed to be the least troublesome method compared to searching for "incorrect" pixels.
Accordingly, the black border can also be drawn on the lower, transparent layer.
Of course, this method works not only with an empty icon, but also with any non-empty icon where all the pixels that you want to be transparent are already transparent. But it's more universal to find an empty one.
Well, if you get suggestions for other methods, that's good; maybe it will be even more convenient.
----
And one more thing, if needed, you can determine the color of a pixel in any editor after the image has been merged, using the eyedropper tool on the desired pixel. There you can see if it's black or white (it seems that it should be transparent in any case).
----
In general, in such a description, it sounds super complicated, but in reality, it's... Simpler. So, if it's still relevant, tomorrow I'll try to make some screenshots in Paint.NET showing how I do it there.