public void BenchmarkCreateChainFromBlocks() { BlockStore store = new BlockStore(@"E:\Bitcoin\blocks\", Network.Main); Chain chain = null; var fullBuild = Bench(() => { chain = store.BuildChain(); }); chain.Changes.Rewind(); var rebuildFromMemory = Bench(() => { var chain2 = new Chain(chain.Changes); }); chain.Changes.Rewind(); var halfChain = new StreamObjectStream <ChainChange>(); for (int i = 0; i < 300000; i++) { halfChain.WriteNext(chain.Changes.ReadNext()); } var halfBuild = Bench(() => { var fullChain = store.BuildChain(halfChain); }); }
public void CanBuildChainFromBlocks() { var store = new BlockStore(@"data\blocks", Network.Main); var chain = store.BuildChain(); Assert.True(chain.Height == 599); }