I'm looking for a way to verify if the current getwork I'm on is from the current, or last block. Would I be able to do that by looking at "prev_block", and checking against a stored array of the "prev_block" from the previous two blocks?
Like, I have an array with the two last known prev_block values in it. If the prev_block value from the getwork matches the newest stored prev_block value, I know it's from the current block. If it matches the oldest prev_block value, it's from the block prior to the current. Correct?
That won't work unless your getwork is putting you
back to a block you've already seen, which it shouldn't do. The problem is getting the hash for the most recent block, which you have never seen before.
If you only need to get this data once in a while, you could use this:
http://blockexplorer.com/q/latesthashOtherwise, you could patch your Bitcoin to support jgarzik's getblockbycount and then combine getblockbycount with getblockcount to get the hash of the latest block. If you have access to Bitcoin's debug.log, you can search it to find the latest block hash.