<p>If a block contains an invalid transaction, it will be rejected by all honest full nodes. Full nodes verify transactions in a block in linear order, so after the first transaction is encountered, the nodes will deem the UTXOs being used as spent. Then when the second transaction (the double spend) is encountered, the nodes will see it as trying to spend already-spent outputs, and reject it along with the block.</p>

CC BY-SA 3.0
2017-08-08T23:35:36.267Z
Also, this is the code where the blocks are checked for double-spends: https://github.com/bitcoin/bitcoin/blob/c1c671feb163c2b3baa2caf97b05a997187e55d5/src/validation.cpp#L1790
Nick ODell
CC BY-SA 3.0
2017-08-08T22:59:26.903Z
2017-08-08T22:59:26.903Z
meshcollider
<p>Imagine a malminer with two important abilities: having enough hashrate for producing blocks in a single-miner mode in reasonable amount of time and having a malconfigured miner software which doing somewhat a usual mining job, but forces some malminer's coins to be spend twice instead of processing only first transaction. What will next miner do if he will get the misledgered block with all others conditions satisfying (correct coin owner's signature, enough proof-of-bruteforse zeroes in checksum, 6 trailing blocks without double-spending, etc)? If the attack is not possible, I want to look at the code behind such a protection.</p>

<transactions><mining-theory><doublespend>
Misledgering possibility for double spending attack
Eimrine
# Misledgering possibility for double spending attack

(Asked by: username_0 on 2017-08-08)

Imagine a malminer with two important abilities: having enough hashrate for producing blocks in a single-miner mode in reasonable amount of time and having a malconfigured miner software which doing somewhat a usual mining job, but forces some malminer's coins to be spend twice instead of processing only first transaction. What will next miner do if he will get the misledgered block with all others conditions satisfying (correct coin owner's signature, enough proof-of-bruteforse zeroes in checksum, 6 trailing blocks without double-spending, etc)? If the attack is not possible, I want to look at the code behind such a protection.

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


---

## 1 answers

### Answer by username_1 on 2017-08-08. Score: 1 | Accepted answer

If a block contains an invalid transaction, it will be rejected by all honest full nodes. Full nodes verify transactions in a block in linear order, so after the first transaction is encountered, the nodes will deem the UTXOs being used as spent. Then when the second transaction (the double spend) is encountered, the nodes will see it as trying to spend already-spent outputs, and reject it along with the block.

> **Comments:**
> **username_2**: Also, this is the code where the blocks are checked for double-spends: https://github.com/bitcoin/bitcoin/blob/c1c671feb163c2b3baa2caf97b05a997187e55d5/src/validation.cpp#L1790  

---

