How to restrict stranger messages in WhatsApp
There's no method of blocking messages

Ex:Let's say you receive a message on what's app from an unknown number not in your contact list.Whatsapp will undoubtedly display that message as it's functionality say's so.

Once you have received the number you are aware that the number is unwanted and you can block it.
Note:-Here you are only blocking the number from seeing your last seen,read,display picture,name but it will not refrain/stop the number from sending messages.

There is no feature in what's app to block any number from sending messages.The feature may be added in the upcoming updates