At this stage, the matching engine observes that you want to buy at $32, and someone is willing to sell at less than $32. You trade directly with that person at $32.
It's actually illegal for any matching engine to match the $31.90 bid, they must cross trades at the NBBO.
Comments
You place a limit order to buy FOO at $32
Someone else offers FOO at $31.90
At this stage, the matching engine observes that you want to buy at $32, and someone is willing to sell at less than $32. You trade directly with that person at $32.
It's actually illegal for any matching engine to match the $31.90 bid, they must cross trades at the NBBO.