Do midwives have to know the gender?

So this may be a silly question but long story short.. with my first baby we didn't find out the gender. We wanted it to be a surprise and was so excited!! And we managed to get to approximately an hour before baby was born not knowing the gender and then the student midwife let it slip that we were having a boy 🙈🙈🙈 obviously we were still excited and I was so high on drugs from a long labour I just pretended I didn't hear lol but we don't want to find out gender again and have a surprise but also nervous that this could happen again... do the midwives really need to know the gender before? Can it be a surprise for them too? 🙈😂