Exemplo n.º 1
0
        public void CheckBlockTest()
        {
            Example.Blockchain chain  = new Example.Blockchain();
            BlockchainHelper   helper = new BlockchainHelper();

            Dictionary <string, decimal> states = new Dictionary <string, decimal>();

            states.Add("Alice", 5);
            states.Add("Bob", 5);

            TransactionPart alice       = new TransactionPart("Alice", -3);
            TransactionPart bob         = new TransactionPart("Bob", 3);
            Transaction     transaction = new Transaction(alice, bob);

            Block newBlock    = helper.CreateBlock(transaction, chain);
            Block parentBlock = chain.Chain[0];

            Miner         miner = new Miner();
            List <string> errors;

            miner.CheckBlock(newBlock, parentBlock, states, out errors);

            Assert.AreEqual(0, errors.Count);
        }