Post by Peter ToddWhile blocks are propagating throughout the network, frequently it's
possible for miners to get the header of the block before they get and
fully validate the block itself. This is just a few seconds to tens of
seconds, but that's a big deal for profitability. So miners have been
running custom patches that mine on top of the longest chain they know
about, even if they haven't actually verified the blocks in it due to
propagation delays.
Is the invalid fork pretty much all empty blocks then?
SPV mining isn't inherently dangerous, if it is only for a short period of
time. It can boost the total work for the block chain.
Inherently, invalid blocks are rare, so assuming a header is valid is the
correct assumption.
For safety (for the miner), SPV miners should switch back to full mining
after 20-30 seconds without fully validating the chain that they are on.
- header received
- header verified (they skipped this step)
- build on header with empty block
- receive full block
-- mark header as invalid if this step times out
- verify full block
-- mark header as invalid if verification fails
- build on full block with non-empty block
An easier rule is that you only build on a header if the header's parent
(or even grandparent) has been fully verified. That rule would prevent the
illegal fork from growing past 1-2 blocks. It would mean that SPV miners
would start wasting hashing power once the invalid fork hit 2 blocks. They
wouldn't even build on their own block.
I guess miners never added code of that kind? That is pretty shocking that
a majority would SPV mine without that safeguard against the main
vulnerability of SPV mining.
Even waiting a few minutes before switch back would protect against this.
Worse, in this case, is that it wasn't just an invalid block, it was an
invalid header chain. They could have done the check with headers only.