Exemplo n.º 1
0
        private void Announce(BlockBroadcast tx, byte[] hash)
        {
            var node = AttachedNode;

            if (node != null && node.State == NodeState.HandShaked)
            {
                tx.State         = BroadcastState.Announced;
                tx.AnnouncedTime = DateTime.UtcNow;
                node.SendMessageAsync(tx.Block).ConfigureAwait(false);
            }
        }
Exemplo n.º 2
0
        internal void BroadcastBlockCore(Types.Block block)
        {
            if (block == null)
            {
                throw new ArgumentNullException("block");
            }
            var tx = new BlockBroadcast();

            tx.Block = block;
            tx.State = BroadcastState.NotSent;
            var hash = GetHash(block);

            if (_HashToBlock.TryAdd(hash, tx))
            {
                Announce(tx, hash);
            }
        }