public void NotifyOfNewBlock(Block block, SendBlockPriority priority) { if (priority == SendBlockPriority.High) { ReceivedBlocks.Push(block); } }
public void NotifyOfNewBlock(Block block, SendBlockPriority priority) { if (priority == SendBlockPriority.High) { SendNewBlock(block); } else { HintNewBlock(block.Hash, block.Number); } }
public override void NotifyOfNewBlock(Block block, SendBlockPriority priority) { if (RequestedAnnounceType == LesAnnounceType.None) { return; } if (!block.TotalDifficulty.HasValue) { throw new InvalidOperationException($"Trying to send a block {block.Hash} with null total difficulty"); } if (block.TotalDifficulty <= _lastSentBlock.TotalDifficulty) { return; } AnnounceMessage announceMessage = new AnnounceMessage(); announceMessage.HeadHash = block.Hash; announceMessage.HeadBlockNo = block.Number; announceMessage.TotalDifficulty = block.TotalDifficulty.Value; if (_lastSentBlock == null || block.ParentHash == _lastSentBlock.Hash) { announceMessage.ReorgDepth = 0; } else { BlockHeader firstCommonAncestor = SyncServer.FindLowestCommonAncestor(block.Header, _lastSentBlock); if (firstCommonAncestor == null) { throw new SubprotocolException($"Unable to send announcment to LES peer - No common ancestor found between {block.Header} and {_lastSentBlock}"); } announceMessage.ReorgDepth = _lastSentBlock.Number - firstCommonAncestor.Number; } _lastSentBlock = block.Header; Send(announceMessage); }
public void NotifyOfNewBlock(Block block, SendBlockPriority priority) { throw new NotImplementedException(); }
public void NotifyOfNewBlock(Block block, SendBlockPriority priority) { }
public abstract void NotifyOfNewBlock(Block block, SendBlockPriority priority);