Looking at the code there could be a more clever way to validate (and potentially repair) a flash operation:
- Read current MAC address and remember it
- Flash image
- Read MAC address and compare with the one remembered
- In case the current and remembered don't match restore the old by only writing the old MAC address
While this won't guarantee failure-freedom it would certainly result in less occasions on which the MAC address of the node is damaged.