The easiest way to make sure they are all correct is to first set all tiles that are known to be bright to their correct values. Then do multiple passes where you check all neighboring tiles to “expand” the light to neighbors.
Example: You have a single bright block with a light value of 8 surrounded by dark (light value 0) blocks. You do a pass to spread the light to nearby tiles, where each tile checks its neighboring tile and sets its own light to the maximum of the neighbors minus one (or itself if it’s already brighter than the neighbors). This pass will cause the blocks next to the bright block to gain a light value of 7. Then you can run the exact same pass again, causing the next set of neighbors to gain a light value of 6. You can repeat this until no tiles were updated, at which point you stop.
Obviously you’d not want to do this each game update, but to update the lighting every time a block changes. If your world is big, you can split up the world into chunks of, say, 16x16 tiles and only update the tiles that are affected by a given block change.