

Panamá should ban all military ships from all nations from going through the canal. That would go a long way towards promoting world peace and easing trade.
Of course, realistically, they would be invaded by the US faster than you can say “Pissing off the richest military dictatorship in the world isn’t a smart idea”. Still, the idea is appealing.
It’s quite different: the Panama Canal belongs to Panama and theirs to do as they please. Gibraltar, while not international waters, is free to all navigation for the purpose of crossing under the Law of the Sea Convention and may not be closed off by either Spain or Morocco.