I guess I would have to do something like $currentblock - $numConfirmations to be sure it was confirmed in time.
That depends on what information you want.
For example, if you want the block height of the block where the transaction was first confirmed, you could use a combination of getrawtransaction and getblock.
Here's an example using transaction ID 584955e07e3b87bb23446e704c73ce2332ce21adca1798ca1b8590d414a87bd7:
Command:
getrawtransaction 584955e07e3b87bb23446e704c73ce2332ce21adca1798ca1b8590d414a87bd7 1
Result:
{
- snip -
"blockhash" : "000000000000000000c38b7591b174ca4915ced5ff5dc8d9b1883df56899139d",
"confirmations" : 11,
- snip -
}
Command:
getblock 000000000000000000c38b7591b174ca4915ced5ff5dc8d9b1883df56899139d
Result:
{
- snip -
"confirmations" : 11,
"size" : 737575,
"height" : 401460,
- snip -
As you can see, the transaction was first confirmed in the block at height 401460 in the block with hash 000000000000000000c38b7591b174ca4915ced5ff5dc8d9b1883df56899139d
Therefore, if 401460 is less than your target block height, the transaction had at least one confirmation at the time of the target block.
How do you plan on handling re-orgs (where transactions that were confirmed with only 1 or 2 confirmations may become unconfirmed)?
Does it matter how many confirmations the transaction has, or do you just need ot know that it has at least 1?