Bitcoin Forum

Bitcoin => Armory => Topic started by: TierNolan on May 10, 2015, 02:14:56 PM



Title: Block write to disk
Post by: TierNolan on May 10, 2015, 02:14:56 PM
I was looking through main.cpp and it looks like bitcoin core writes unverified blocks to disk.  Does Armory assume that the blk???.dat files are verified?

The TestBlockValidity() (https://github.com/bitcoin/bitcoin/blob/v0.10.1rc3/src/main.cpp#L2765) function goes through the following steps.

CheckBlock -> does basic checks
AcceptBlock -> writes block to disk
ActivateBestChain calls ActivateBestChainStep call ConnectTip calls ConnectBlock -> verifies the scripts

This means that blocks which meet all the basic rules (POW, hashes, size limits etc.) are written to disk even if the scripts fail.



Title: Re: Block write to disk
Post by: goatpig on May 10, 2015, 09:00:41 PM
We build the longest chain based on headers and verify the block data hashes to what the respective header carries. We ultimately trust Core is serving us valid blocks. While Core does write invalid blocks time to time, the only way this could throw off Armory is if Core were to maintain an invalid fork that is stronger than the main valid branch.

I think at this point the network as a whole would have bigger issues to deal with than Armory displaying data from an huge invalid fork.


Title: Re: Block write to disk
Post by: TierNolan on May 10, 2015, 09:38:25 PM
the only way this could throw off Armory is if Core were to maintain an invalid fork that is stronger than the main valid branch.

Fair enough.  The disk records are only assumed to correct, if they are on the main chain and that is fully checked.