Rather than having a dual-mode RPC call, create two RPC calls. Luke-Jr already updated BIP 22 to reflect this.
getblocktemplate mode=template works as before.
New RPC submitblock takes a parameter, a raw serialized block to be decoded and submitted. At Luke-Jr’s request, submitblock ignores an optional second parameter, if present (an Object for future options).
Tertiary RPC cleanup commits are also included.