Implement the submit mode of getblocktemplate.

This patch implements the submit mode to getblocktemplate, often used by stratum servers instead of submitblock.