Esempio n. 1
0
        public bool Validate(BlockChain chain)
        {
            if (chain.Version != CurrentVersion)
            {
                return(false);
            }

            if (chain.IsGenesisBlock())
            {
                return(ValidateLedger(GetLedger(chain)));
            }

            // validate previous block and its targeted hash
            bool previousNodeValid = Validate(chain.PreviousBlock);

            if (!previousNodeValid)
            {
                return(false);
            }

            bool transactionsValid = ValidateLedger(GetLedger(chain));

            return(transactionsValid);
        }
Esempio n. 2
0
 public long GetBlockchainDepth(BlockChain bc)
 {
     return(bc.GetBlockchainDepth());
 }