<p>It is up to individual mining pools to decide how quickly to include newly received transactions. There are no strict rules here and delays of a few minutes are usually acceptable. Transactions with higher fees may encourage miners to include them in a block ASAP.</p>

CC BY-SA 3.0
2014-02-25T07:17:27.207Z
So, a block generated at 09:53:28 is still valid even if it doesn't include a transaction that was transacted at 09:53:27?
Andrew Cheong
CC BY-SA 3.0
2014-02-25T07:22:22.617Z
Yes. In fact miners have no obligation to include any  transaction before a "deadline" -- it is only done on a best effort basis. It is perfectly acceptable for a mining pool to aggregate new transactions in a queue and only include them say every 5 minutes.
uminatsu
CC BY-SA 3.0
2014-02-25T07:53:31.080Z
If there was a way to ensure that everyone agreed when a transaction was performed and saw it when they had to decide whether a block was valid, there would be no need for mining.
David Schwartz
CC BY-SA 3.0
2014-02-25T07:04:58.137Z
2014-02-25T07:04:58.137Z
uminatsu
<p>Miners have total freedom to choose which transactions they will include in their blocks. Most miners will include any transaction that reaches them (assuming it includes an appropriate fee) but nothing forces them to do so.</p>

<p>But if a miner decides, for whatever reason, to omit a particular transaction, or if it's omitted by an accident of timing, no permanent harm is done. Another miner can include that transaction in a later block with no problem. Transactions don't even have a timestamp, per se, so it's not a problem if it takes a long time (other than the inconvenience to the parties involved). (Blockchain.info and its ilk may record the time at which they first saw the transaction on the network, but that time stamp isn't part of the transaction itself, as far as I know.)</p>

CC BY-SA 3.0
2014-02-25T07:32:43.093Z
I see, thanks. One follow-up question though, to make sure I understand this. Does that mean that a miner may, theoretically, solve a block without including _any_ new transactions?—that is, the same set of transactions as the previous block? (As I understand, the new block must include the hash of the previous block, so it's just as difficult a problem.) If so, is the only reason this doesn't happen, that miners wouldn't collect transaction fees by doing so?
Andrew Cheong
CC BY-SA 3.0
2014-02-25T07:37:47.560Z
@acheong: Yes, indeed, a block with no transactions is still valid. There was a previous question addressing this but I can't conveniently find it right now.
Nate Eldredge
CC BY-SA 3.0
2014-02-25T07:24:14.137Z
2014-02-25T07:24:14.137Z
Nate Eldredge
<p>I read <a href="https://bitcoin.stackexchange.com/questions/148/what-exactly-is-mining/760#760">What exactly is Mining?</a> and <a href="https://bitcoin.stackexchange.com/questions/8031/what-are-bitcoin-miners-really-solving/8033#8033">What are bitcoin miners really solving?</a>, but was left wondering: What happens if a new transaction comes in, whilst mining? To answer that, I found <a href="https://bitcoin.stackexchange.com/questions/16606/do-transactions-affect-the-discovery-of-a-block">Do transactions affect the discovery of a block?</a>, which, if I understand correctly, says that the mining must "start over" (but the chances of finding the "nonce" on the first attempt are about the same as any subsequent attempts, so there's no "loss of work").</p>

<p>But, what about network latency? It must take a finite amount of time for a new transaction to reach miners—so what happens if a miner solves a block, but then receives a transaction timestamped <em>before</em> the block was solved?</p>

<block><network><mining-theory><transaction-selection><latency>
Does a new block necessarily include all transactions that occurred before its generation? What about network latency?
Andrew Cheong
# Does a new block necessarily include all transactions that occurred before its generation? What about network latency?

(Asked by: username_0 on 2014-02-25)

I read [What exactly is Mining?](https://bitcoin.stackexchange.com/questions/148/what-exactly-is-mining/760#760) and [What are bitcoin miners really solving?](https://bitcoin.stackexchange.com/questions/8031/what-are-bitcoin-miners-really-solving/8033#8033), but was left wondering: What happens if a new transaction comes in, whilst mining? To answer that, I found [Do transactions affect the discovery of a block?](https://bitcoin.stackexchange.com/questions/16606/do-transactions-affect-the-discovery-of-a-block), which, if I understand correctly, says that the mining must "start over" (but the chances of finding the "nonce" on the first attempt are about the same as any subsequent attempts, so there's no "loss of work").

But, what about network latency? It must take a finite amount of time for a new transaction to reach miners—so what happens if a miner solves a block, but then receives a transaction timestamped *before* the block was solved?

**Tags:** block, network, mining-theory, transaction-selection, latency


---

## 2 answers

### Answer by username_3 on 2014-02-25. Score: 4 | Accepted answer

Miners have total freedom to choose which transactions they will include in their blocks. Most miners will include any transaction that reaches them (assuming it includes an appropriate fee) but nothing forces them to do so.

But if a miner decides, for whatever reason, to omit a particular transaction, or if it's omitted by an accident of timing, no permanent harm is done. Another miner can include that transaction in a later block with no problem. Transactions don't even have a timestamp, per se, so it's not a problem if it takes a long time (other than the inconvenience to the parties involved). (Blockchain.info and its ilk may record the time at which they first saw the transaction on the network, but that time stamp isn't part of the transaction itself, as far as I know.)

> **Comments:**
> **username_0**: I see, thanks. One follow-up question though, to make sure I understand this. Does that mean that a miner may, theoretically, solve a block without including _any_ new transactions?—that is, the same set of transactions as the previous block? (As I understand, the new block must include the hash of the previous block, so it's just as difficult a problem.) If so, is the only reason this doesn't happen, that miners wouldn't collect transaction fees by doing so?  
> **username_3**: @acheong: Yes, indeed, a block with no transactions is still valid. There was a previous question addressing this but I can't conveniently find it right now.  

---

### Answer by username_1 on 2014-02-25. Score: 3

It is up to individual mining pools to decide how quickly to include newly received transactions. There are no strict rules here and delays of a few minutes are usually acceptable. Transactions with higher fees may encourage miners to include them in a block ASAP.

> **Comments:**
> **username_0**: So, a block generated at 09:53:28 is still valid even if it doesn't include a transaction that was transacted at 09:53:27?  
> **username_1**: Yes. In fact miners have no obligation to include any  transaction before a "deadline" -- it is only done on a best effort basis. It is perfectly acceptable for a mining pool to aggregate new transactions in a queue and only include them say every 5 minutes.  
> **username_2**: If there was a way to ensure that everyone agreed when a transaction was performed and saw it when they had to decide whether a block was valid, there would be no need for mining.  

---

