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