Beispiel #1
0
 public void ValidateBlockCalculations(
     Block actual,
     Block expectedHeader,
     Hash256 expectedHash,
     Hash256[] expectedMerkleTree)
 {
     BlockTest.AssertThatMerkleTreeMatches(actual.MerkleTree, expectedMerkleTree);
     BlockTest.AssertThatBlockHeaderMatches(actual, expectedHeader);
     BitcoinObjectTest.AssertThatHashMatches(actual, expectedHash);
 }
Beispiel #2
0
 public static void AssertThatBlockHeaderMatches(
     Block actualBlock,
     Block expectedBlock)
 {
     BlockTest.AssertThatBlockHeaderMatches(
         actualBlock,
         expectedBlock.Version,
         expectedBlock.PreviousBlockHash,
         expectedBlock.MerkleRoot,
         expectedBlock.Timestamp,
         expectedBlock.DifficultyBits,
         expectedBlock.Nonce);
 }
Beispiel #3
0
        public void RoundTripBitcoinSerializedBlocks(
            byte[] serializedBlock,
            int offset,
            Block expectedHeader,
            Hash256 expectedHash,
            IEnumerable <Hash256> expectedMerkleTree)
        {
            var block = new Block(serializedBlock, offset);

            BlockTest.AssertThatMerkleTreeMatches(block.MerkleTree, expectedMerkleTree);
            BlockTest.AssertThatBlockHeaderMatches(block, expectedHeader);
            BitcoinObjectTest.AssertThatHashMatches(block, expectedHash);
            BitcoinSerializableTest.AssertThatSerializedArrayMatches(serializedBlock, block);
        }