Exemple #1
0
        public bool Update(Chain chain, IndexedBlockStore store)
        {
            if (_CurrentChain == null || !chain.SameTip(_CurrentChain))
            {
                List <ChainedBlock> unprocessed = null;
                Accounts.Update(chain);
                if (_CurrentChain == null)
                {
                    _CurrentChain = chain.Clone(new StreamObjectStream <ChainChange>());
                    unprocessed   = chain.ToEnumerable(false).ToList();
                }
                else
                {
                    var fork = _CurrentChain.SetTip(chain.Tip);
                    unprocessed = _CurrentChain.EnumerateAfter(fork).ToList();
                }

                foreach (var block in unprocessed)
                {
                    ReceiveBlock(store.Get(block.HashBlock));
                }
                return(true);
            }
            return(false);
        }
Exemple #2
0
        public bool Update(Chain chain, IndexedBlockStore store)
        {
            if(_CurrentChain == null || !chain.SameTip(_CurrentChain))
            {
                List<ChainedBlock> unprocessed = null;
                Accounts.Update(chain);
                if(_CurrentChain == null)
                {
                    _CurrentChain = chain.Clone(new StreamObjectStream<ChainChange>());
                    unprocessed = chain.ToEnumerable(false).ToList();
                }
                else
                {
                    var fork = _CurrentChain.SetTip(chain.Tip);
                    unprocessed = _CurrentChain.EnumerateAfter(fork).ToList();
                }

                foreach(var block in unprocessed)
                {
                    ReceiveBlock(store.Get(block.HashBlock));
                }
                return true;
            }
            return false;
        }
Exemple #3
0
 public ChainedBlock FindFork(Chain chain)
 {
     return(FindFork(chain.ToEnumerable(true).Select(o => o.HashBlock)));
 }
Exemple #4
0
 public ChainedBlock FindFork(Chain chain)
 {
     return FindFork(chain.ToEnumerable(true).Select(o => o.HashBlock));
 }