예제 #1
0
        //Add transactions
        public bool AddTransaction(Transaction transaction)
        {
            //Try to process transaction if valid. If block is genesis block then ignore.
            if (transaction == null)
            {
                return(false);
            }

            if (PreviousBlockHash != null)
            {
                if ((transaction.ProcessTransaction() != true))
                {
                    Console.WriteLine("!!! - Process failed. Discarded.");
                    return(false);
                }
            }

            TransactionData.Add(transaction);
            Console.WriteLine("#Transaction Successfully added to Block");

            return(true);
        }