It's a easy question:
Imagine 2 nodes, they two have different transactions on them.
Node B finish to mine the block first, it broadcasts it and the network accept it.
Ok.
Would this node inmediately continue proof of work even if the transaction pool is empty?
Lately, the transaction pool is never empty. There are more transactions than fit in a block. Therefore, there are always more transactions waiting for the next block.
However, if the transaction pool was empty, the miner can create the transaction that pays himself the block reward, and then build a block from that transaction. Therefore, a block always has at least 1 transaction in it.
What would happen if he mine the block and new transactions would come in?
Do you mean that he is in the process of mining the block, but has not found the solution yet? Or do you mean that he finished mining the block, has the solution for the block that has only 1 transaction in it, and then before he can broadcast it, more transactions come in?
If he hasn't found a solution yet, then he can build a new block header from the new transaction list and start mining on that new header. This way, if he solves the block, he can increase his revenue with the additional transaction fees.
If he has just found a solution, then he can immediately broadcast the block that has only one transaction, and then immediately start a new block with the transactions that he has just received. That way he can collect the block subsidy that he has already earned.
He would to start again with the new transaction because the tx are included in the block so the hash of the block changes, so he each time new tx are added the node has to restart the PoW, Right?
Every hash attempt is a new start to the PoW. It doesn't matter if you have tried a million hashes, or one hash. In either case the next hash attempt is equally likely to be successful. Therefore, there is no wasted effort to start with a new block header.
Unless the miners wants to waste his resources, they won't discard a valid block even if new transactions with larger fees gets relayed to them.
When you say "valid" block, I assume you are talking about a "solved" block? In that case your are correct. The miner just broadcasts the solved block and then immediately starts on a new block with the transactions in it.
On the other hand, if you are talking about a block that has been built , but which has not had the proof-of-work solved yet, then there is no waste of resources to discard the current unsolved block and start over with a new block.
There is no restrictions about how many transactions a miner should include. He is free to decide.
There are two legacy restrictions and one new restriction.
Legacy Restriction 1: The block MUST contain the "coinbase" transaction.
Legacy Restriction 2: The total number of bytes in the non-witness portion MUST be less than one megabyte.
New Restriction 1: The total block weight MUST be less than four megabytes.