I searched this question and couldn't find an answer to the following scenario.
Block 4440 gets mined at 10:00 AM Block 4441 gets mined at 10:01 AM
Lets assume I receive Block 4441 first and 4440 later. What happens? When I received 4441 I didnt know the block with the previous hash and I wasn't able to add 4441 to my chain.
Do I store these kinds of blocks with an unknown previous header in a pool and check periodically if I received the previous block?
Assuming we do this, do you ever remove old blocks from this pool?
If we save "invalid" blocks, how do we prevent people from submitting thousands of invalid blocks and filling up our pool? I assume we check if the difficulty was met but what happens if block 4440 lowered the required difficulty?