Beispiel #1
0
 public void TestHeaderParse()
 {
     var block = new Block(_params, _blockBytes);
     var header = block.CloneAsHeader();
     var reparsed = new Block(_params, header.BitcoinSerialize());
     Assert.AreEqual(reparsed, header);
 }
Beispiel #2
0
 /// <summary>
 /// Creates a new StoredBlock, calculating the additional fields by adding to the values in this block.
 /// </summary>
 /// <exception cref="VerificationException"/>
 public StoredBlock Build(Block block)
 {
     // Stored blocks track total work done in this chain, because the canonical chain is the one that represents
     // the largest amount of work done not the tallest.
     var chainWork = _chainWork.Add(block.GetWork());
     var height = _height + 1;
     return new StoredBlock(block.CloneAsHeader(), chainWork, height);
 }