예제 #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);
        }
예제 #2
0
 public long GetBlockchainDepth(BlockChain bc)
 {
     return(bc.GetBlockchainDepth());
 }