code: func handleSubmitBlock(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {
  	c := cmd.(*btcjson.SubmitBlockCmd)
  
  	// Deserialize the submitted block.
  	hexStr := c.HexBlock
  	if len(hexStr)%2 != 0 {
  		hexStr = "0" + c.HexBlock
  	}
  	serializedBlock, err := hex.DecodeString(hexStr)
  	if err != nil {
  		return nil, rpcDecodeHexError(hexStr)
  	}
  
  	block, err := btcutil.NewBlockFromBytes(serializedBlock)
  	if err != nil {
  		return nil, &btcjson.RPCError{
  			Code:    btcjson.ErrRPCDeserialization,
  			Message: "Block decode failed: " + err.Error(),
  		}
  	}
  
  	// Process this block using the same rules as blocks coming from other
  	// nodes.  This will in turn relay it to the network like normal.
  	_, err = s.cfg.SyncMgr.SubmitBlock(block, blockchain.BFNone)
  	if err != nil {
  		return fmt.Sprintf("rejected: %s", err.Error()), nil
  	}
  
  	rpcsLog.Infof("Accepted block %s via submitblock", block.Hash())
  	return nil, nil
  }
docs: // handleSubmitBlock implements the submitblock command.