<p>A modern mining system will do both.</p>

<p>Today, miners and mining pools have more hashpower than required to check all iterations of a nonce and extraNonce for a single block template. They get around this by consecutively operating on multiple block templates, usually varying on the block timestamp, data in the Coinbase transaction, and the list of selected transactions.</p>

<p>These updated block templates are constantly generated in parallel to the actual hashing operations - as more attractive transactions are discovered, the next set of block templates generated will be updated to contain those transactions. As soon as the mining hardware finishes with its current block template, it will grab a new, likely optimal template from the pool.</p>

<p>If a single worked discovers a valid block with a suboptimal template, miners will broadcast that block - there is little sense in discarding a block over a relatively small fee increase and giving up the entire block reward.</p>

CC BY-SA 4.0
2020-03-07T09:24:40.577Z
Perhaps importantly the cost of transmission for a solution is essentially zero.
Claris
CC BY-SA 4.0
2020-03-07T08:50:12.283Z
2020-03-07T08:50:12.283Z
Raghav Sood
<blockquote>
  <p>When a miner have constructed a block (step 1) and is trying to solve the puzzle (step 2), a very attractive transaction with high fee comes, will the miner give up the work he has done, reconstruct the block and restart solving the puzzle?</p>
</blockquote>

<p>Either that work produced a block or it did not. If it produced a block, he will definitely broadcast that block. If it did not produce a block, then he loses nothing by giving it up. So there's no "work he has done" that he might "give up".</p>

<p>Work that miners do either produces a block or it doesn't. There's no way to be part way to producing a block only to start over.</p>

CC BY-SA 4.0
2020-03-09T02:50:31.567Z
2020-03-09T02:50:31.567Z
David Schwartz
<p>The block template is updated, (maybe) every a few seconds, updated with new transactions.</p>

<blockquote>
  <p>will the miner give up the work he has done</p>
</blockquote>

<p>Every block with a hash satisfying the target is propagated. But if a block wasn't made, remember that mining is a Poisson Process, with the most important property being <strong>memoryless</strong>-ness. If a block takes 10 minutes on average to mine, and after 5 minutes of mining, changing the block template wouldn't reduce the time expected until the next block (hence "give up" is not the best word)</p>

<blockquote>
  <p>reconstruct the block and restart solving the puzzle?</p>
</blockquote>

<p>Yes.</p>

CC BY-SA 4.0
2020-03-07T15:07:55.557Z
Let's consider this situation: before the high-fee transaction comes, a miner didn't update his block and kept changing the "nonce" of the same block, the space of the useless results he got is S. Now the high-fee transaction comes, the miner reconstructs the block and restarts solving the puzzle, what if the results he gets fall into S again? Doesn't it mean that the work he has done is wasted?
Better
CC BY-SA 4.0
2020-03-07T18:45:53.287Z
SHA256, like other good cryptographic hash functions, has avalanche effect, which means even one bit changed in the input will cause the output to be entirely different. The new hashes found will be entirely different as the Merkle hash of the transactions (or the hash of all TXIDs in the block) can also act as a nonce to change output hash. @Better
MCCCS
CC BY-SA 4.0
2020-03-07T21:37:17.277Z
Computing a single hash takes time in the order of nanoseconds, and every attempt is independent. It's not because you've tried a billion failed hashes already that you're in any way "closer" to finding a solution. In other words: PoW is progress free, apart from the time it takes to compute a single hash, which is so short compared to the time scale at which transactions happen.
Pieter Wuille
CC BY-SA 4.0
2020-03-07T08:54:21.217Z
2020-03-07T08:54:21.217Z
MCCCS
<p>As far as I have known, the mining process is as follows, </p>

<p>step 1: collect a series of transactions and construct a block by filling required information like hash of the previous block and the Merkle tree root, etc. </p>

<p>step 2: solving a puzzle by constantly changing the 'nonce' field of the block to make the hash of the block header less than a target. </p>

<p>When a miner have constructed a block (step 1) and is trying to solve the puzzle (step 2), a very attractive transaction with high fee comes, will the miner give up the work he has done, reconstruct the block and restart solving the puzzle?</p>

CC BY-SA 4.0
2020-03-08T08:52:41.423Z
What work would he give up exactly?
David Schwartz
CC BY-SA 4.0
2020-03-09T02:40:21.220Z
The work to change the "nonce" of the current block
Better
<blockchain><proof-of-work>
What will a miner do when a high-fee transaction comes but he has constructed his block and is solving the puzzle?
Better
# What will a miner do when a high-fee transaction comes but he has constructed his block and is solving the puzzle?

(Asked by: username_0 on 2020-03-07)

As far as I have known, the mining process is as follows,

step 1: collect a series of transactions and construct a block by filling required information like hash of the previous block and the Merkle tree root, etc.

step 2: solving a puzzle by constantly changing the 'nonce' field of the block to make the hash of the block header less than a target.

When a miner have constructed a block (step 1) and is trying to solve the puzzle (step 2), a very attractive transaction with high fee comes, will the miner give up the work he has done, reconstruct the block and restart solving the puzzle?

**Tags:** blockchain, proof-of-work

> **Comments:**
> **username_1**: What work would he give up exactly?  
> **username_0**: The work to change the "nonce" of the current block  

---

## 3 answers

### Answer by username_2 on 2020-03-07. Score: 4

A modern mining system will do both.

Today, miners and mining pools have more hashpower than required to check all iterations of a nonce and extraNonce for a single block template. They get around this by consecutively operating on multiple block templates, usually varying on the block timestamp, data in the Coinbase transaction, and the list of selected transactions.

These updated block templates are constantly generated in parallel to the actual hashing operations - as more attractive transactions are discovered, the next set of block templates generated will be updated to contain those transactions. As soon as the mining hardware finishes with its current block template, it will grab a new, likely optimal template from the pool.

If a single worked discovers a valid block with a suboptimal template, miners will broadcast that block - there is little sense in discarding a block over a relatively small fee increase and giving up the entire block reward.

> **Comments:**
> **username_3**: Perhaps importantly the cost of transmission for a solution is essentially zero.  

---

### Answer by username_1 on 2020-03-09. Score: 2

> When a miner have constructed a block (step 1) and is trying to solve the puzzle (step 2), a very attractive transaction with high fee comes, will the miner give up the work he has done, reconstruct the block and restart solving the puzzle?

Either that work produced a block or it did not. If it produced a block, he will definitely broadcast that block. If it did not produce a block, then he loses nothing by giving it up. So there's no "work he has done" that he might "give up".

Work that miners do either produces a block or it doesn't. There's no way to be part way to producing a block only to start over.


---

### Answer by username_4 on 2020-03-07. Score: 2

The block template is updated, (maybe) every a few seconds, updated with new transactions.

> will the miner give up the work he has done

Every block with a hash satisfying the target is propagated. But if a block wasn't made, remember that mining is a Poisson Process, with the most important property being **memoryless**-ness. If a block takes 10 minutes on average to mine, and after 5 minutes of mining, changing the block template wouldn't reduce the time expected until the next block (hence "give up" is not the best word)

> reconstruct the block and restart solving the puzzle?

Yes.

> **Comments:**
> **username_0**: Let's consider this situation: before the high-fee transaction comes, a miner didn't update his block and kept changing the "nonce" of the same block, the space of the useless results he got is S. Now the high-fee transaction comes, the miner reconstructs the block and restarts solving the puzzle, what if the results he gets fall into S again? Doesn't it mean that the work he has done is wasted?  
> **username_4**: SHA256, like other good cryptographic hash functions, has avalanche effect, which means even one bit changed in the input will cause the output to be entirely different. The new hashes found will be entirely different as the Merkle hash of the transactions (or the hash of all TXIDs in the block) can also act as a nonce to change output hash. @username_0  
> **username_5**: Computing a single hash takes time in the order of nanoseconds, and every attempt is independent. It's not because you've tried a billion failed hashes already that you're in any way "closer" to finding a solution. In other words: PoW is progress free, apart from the time it takes to compute a single hash, which is so short compared to the time scale at which transactions happen.  

---

