Exemple #1
0
        private Block addBlock()
        {
            Block        lastBlock   = storedChain.Last;
            IHashFactory hashFactory = MiningFactory.GetMiningHashFactoryForTransactions(pendingTransactions, lastBlock);
            Block        block       = new Block(MiningWallet.PublicKey, lastBlock.Hash, pendingTransactions, hashFactory);
            IMiner       miner       = MiningFactory.GetMiner(block.Transactions, lastBlock);

            miner.MineBlock(block);
            block.SignBlock(MiningWallet.Signer);

            storedChain.AddBlock(block);
            WalletManager.AcceptTransactions(block.Transactions);

            return(block);
        }