After following instructions to unlock a bootloader and then ones to lock it back, using Fastboot for both, my Android 7.0 phone boots with a warning saying that Your device has failed validation instead of the Your device has been unlocked which happened after unlocking but before undoing. In either case, this had an effect on the Android system and the phone appeared as Uncertified and failed the SafetyNet check.
How can one fully undo bootloader unlocking so that the device does not fail validation and passes the SafetyNet check?
Since it can make a difference, the device in question is a Moto G5. It was unlocked following the official instructions on the Motorola website. No new ROMS were flashed, it was only used to get Magisk to install. This resulting in a warning that the bootloader was unlocked. So I thought it just needed to be locked again and I did it with fastboot. This unfortunately resulted in another warning which says validation failed.