Exemple #1
0
        public ChainedBlock SetTip(ChainBase otherChain)
        {
            if (otherChain == null)
            {
                throw new ArgumentNullException(nameof(otherChain));
            }

            return(SetTip(otherChain.Tip));
        }
Exemple #2
0
        public bool SameTip(ChainBase chain)
        {
            if (chain == null)
            {
                throw new ArgumentNullException(nameof(chain));
            }

            return(Tip.HashBlock == chain.Tip.HashBlock);
        }
Exemple #3
0
        /// <summary>
        ///     Returns the first common block between two chains
        /// </summary>
        /// <param name="chain">The other chain</param>
        /// <returns>First common block or null</returns>
        public ChainedBlock FindFork(ChainBase chain)
        {
            if (chain == null)
            {
                throw new ArgumentNullException(nameof(chain));
            }

            return(FindFork(chain.Tip.EnumerateToGenesis().Select(o => o.HashBlock)));
        }