code: func handleGetBlockTemplate(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
  	c := cmd.(*btcjson.GetBlockTemplateCmd)
  	request := c.Request
  
  	// Set the default mode and override it if supplied.
  	mode := "template"
  	if request != nil && request.Mode != "" {
  		mode = request.Mode
  	}
  
  	switch mode {
  	case "template":
  		return handleGetBlockTemplateRequest(s, request, closeChan)
  	case "proposal":
  		return handleGetBlockTemplateProposal(s, request)
  	}
  
  	return nil, &btcjson.RPCError{
  		Code:    btcjson.ErrRPCInvalidParameter,
  		Message: "Invalid mode",
  	}
  }
docs: // handleGetBlockTemplate implements the getblocktemplate command.
  //
  // See https://en.bitcoin.it/wiki/BIP_0022 and
  // https://en.bitcoin.it/wiki/BIP_0023 for more details.