<p>Not all blocks are mining the same transactions in their respective proofs-of-work. Each miner collects enough transactions via <a href="https://bitcoin.stackexchange.com/questions/11270/how-do-bitcoin-nodes-know-where-to-send-new-transactions-and-blocks-to">gossip</a> until they reach the block size limit. Not all transactions will make it into a certain block, so those will be more likely candidates to make it into the next block. Miners decide which transactions to include in a block with the following <a href="https://en.bitcoin.it/wiki/Transaction_fees#Priority_transactions" rel="nofollow noreferrer">equation</a>: </p>

<p><code>priority = sum(input_value_in_base_units * input_age)/size_in_bytes</code></p>

CC BY-SA 3.0
2017-10-31T19:58:42.443Z
2017-10-31T19:58:42.443Z
Niraj Pant
<p>If all transactions are broadcast to all nodes, and all nodes are mining these transactions into blocks.  When a block is created and the block is broadcast to all nodes, it may contain transactions that other nodes are currently trying to put into their blocks.....what happens in this scenario?</p>

CC BY-SA 3.0
2017-10-31T16:51:48.160Z
They waste time mining until they get the newest block. This time lag, or rather, attempts to lessen it by not validating before mining on top of it, is what caused the last network split. Generally it's only a few seconds and 2 miners rarely find blocks at the same time. If they do, then the chain splits until one side finds the next block fastest, and everyone moves there and orphans the competing chain.
Luke Mlsna
CC BY-SA 3.0
2017-10-31T19:25:13.503Z
@Luke Mlsna please post answers as answers rather than comments :)
meshcollider
CC BY-SA 3.0
2017-11-04T21:39:12.283Z
@LukeMlsna .... so, if a new block comes in, does a miner stop mining their current block? ....and start on a new block with new transactions?
Shamus Harkin
CC BY-SA 3.0
2017-11-04T21:44:39.377Z
Yes, they immediately drop what they are doing and start mining on top of the newest block. Because any time spent mining a stale block is wasted.
Luke Mlsna
<transactions><unconfirmed-transactions><mining-theory>
How do miners handle transactions when a different miner creates a new block?
Shamus Harkin
# How do miners handle transactions when a different miner creates a new block?

(Asked by: username_0 on 2017-10-31)

If all transactions are broadcast to all nodes, and all nodes are mining these transactions into blocks. When a block is created and the block is broadcast to all nodes, it may contain transactions that other nodes are currently trying to put into their blocks.....what happens in this scenario?

**Tags:** transactions, unconfirmed-transactions, mining-theory

> **Comments:**
> **username_1**: They waste time mining until they get the newest block. This time lag, or rather, attempts to lessen it by not validating before mining on top of it, is what caused the last network split. Generally it's only a few seconds and 2 miners rarely find blocks at the same time. If they do, then the chain splits until one side finds the next block fastest, and everyone moves there and orphans the competing chain.  
> **username_2**: @username_1 please post answers as answers rather than comments :)  
> **username_0**: @username_1 .... so, if a new block comes in, does a miner stop mining their current block? ....and start on a new block with new transactions?  
> **username_1**: Yes, they immediately drop what they are doing and start mining on top of the newest block. Because any time spent mining a stale block is wasted.  

---

## 1 answers

### Answer by username_3 on 2017-10-31. Score: 1

Not all blocks are mining the same transactions in their respective proofs-of-work. Each miner collects enough transactions via [gossip](https://bitcoin.stackexchange.com/questions/11270/how-do-bitcoin-nodes-know-where-to-send-new-transactions-and-blocks-to) until they reach the block size limit. Not all transactions will make it into a certain block, so those will be more likely candidates to make it into the next block. Miners decide which transactions to include in a block with the following [equation](https://en.bitcoin.it/wiki/Transaction_fees#Priority_transactions):

`priority = sum(input_value_in_base_units * input_age)/size_in_bytes`


---

