Exemple #1
0
        internal void Announce(TransactionBroadcast tx, uint256 hash, bool force = false)
        {
            if (!force && BroadcastHub.ManualBroadcast)
            {
                return;
            }
            var node = AttachedNode;

            if (node != null && node.State == NodeState.HandShaked)
            {
                tx.State         = BroadcastState.Announced;
                tx.AnnouncedTime = DateTime.UtcNow;
                node.SendMessageAsync(new InvPayload(InventoryType.MSG_TX, hash)).ConfigureAwait(false);
            }
        }
Exemple #2
0
        internal void BroadcastTransactionCore(Transaction transaction)
        {
            if (transaction == null)
            {
                throw new ArgumentNullException("transaction");
            }
            var tx = new TransactionBroadcast();

            tx.Transaction = transaction;
            tx.State       = BroadcastState.NotSent;
            var hash = transaction.GetHash();

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