Ejemplo n.º 1
0
        public bool ReplaceChain(ReadOnlyCollection <Block> chain)
        {
            if (this.localChain.Count >= chain.Count)
            {
                Logger.Info("The incoming chain must be longer.");
                return(false);
            }
            if (!BlockChain.IsValidChain(chain))
            {
                Logger.Info("The incoming chain must be valid.");
                return(false);
            }
            if (!this.ValidateTransactionData(chain))
            {
                Logger.Info("The incoming chain has invalid transaction.");
                return(false);
            }

            Logger.Info("The incoming chain is valid.");
            this.localChain = chain.ToList();
            Logger.Info("Replaced local chain.");
            return(true);
        }
Ejemplo n.º 2
0
 bool IBlockChain.IsValidChain(ReadOnlyCollection <Block> chain)
 {
     return(BlockChain.IsValidChain(chain));
 }