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); }
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; }
public ChainedBlock FindFork(Chain chain) { return(FindFork(chain.ToEnumerable(true).Select(o => o.HashBlock))); }
public ChainedBlock FindFork(Chain chain) { return FindFork(chain.ToEnumerable(true).Select(o => o.HashBlock)); }