public void BlockHeader_Test()
        {
            var blockHeader = _kernelTestHelper.GenerateBlock(1, Hash.Empty).Header;

            blockHeader.GetDisambiguatingHash().ShouldBe(blockHeader.GetHash());

            blockHeader.MerkleTreeRootOfTransactions = null;
            Assert.Throws <InvalidOperationException>(blockHeader.GetDisambiguatingHash);
        }
Beispiel #2
0
        private Block GenerateBlock()
        {
            var transaction = _kernelTestHelper.GenerateTransaction();
            var block       = _kernelTestHelper.GenerateBlock(10, HashHelper.ComputeFrom("PreviousBlockHash"),
                                                              new List <Transaction> {
                transaction
            });

            block.Header.Signature =
                ByteString.CopyFrom(CryptoHelper.SignWithPrivateKey(_kernelTestHelper.KeyPair.PrivateKey,
                                                                    block.GetHash().ToByteArray()));

            return(block);
        }