A market order is either a sell at $0 or a buy at $inf as far as the trading engine is concerned. You won't be selling at 0 or buying at $inf because it matches bids so you get the best deal. However, there's no extra complexity in a market order.
Yes indeed. Thanks for pointing that out. I was trying to make the situation overly complex by thinking about doing a fill-or-kill instead of an actual market order. That's probably not necessary at all.