A good thing to remember is, it doesn't matter WHERE the block takes place, only WHEN. Even if the block is beyond the restraining line, it's still a foul unless the ball has ALSO gone beyond the restraining line (or been touched by B). This is so Team A cannot just run down and clear out a big area, then wait for the ball to roll across the line.
This is one of the more frequently missed calls, at all levels, even heavily televised ones. The mechanic is for the far-side officials to help out, since the near-side officials have to concentrate on touching and OOB.
It's also important (and sometimes tough) to be sure that Team A is initiating the block. If Team B initiates the contact, it's not a foul on Team A. However, this is uncommon. Team B players aren't usually thinking about throwing blocks on an onside kick. Usually they're busy panicking about grabbing the ball at all costs.