Ejemplo n.º 1
0
Archivo: Miner.cs Proyecto: wyk125/AElf
 private async Task InsertTransactionToPool(Transaction tx)
 {
     if (tx == null)
     {
         return;
     }
     // insert to tx pool and broadcast
     await _txHub.AddTransactionAsync(tx, skipValidation : true).ConfigureAwait(false);
 }
Ejemplo n.º 2
0
        public void Initialize(NodeConfiguration conf)
        {
            _assemblyDir = conf.LauncherAssemblyLocation;
            NodeConfig.Instance.ECKeyPair = conf.KeyPair;

            SetupConsensus();

            MessageHub.Instance.Subscribe <TxReceived>(async inTx =>
            {
                await _txHub.AddTransactionAsync(inTx.Transaction);
            });

            _txHub.Initialize();
        }
Ejemplo n.º 3
0
Archivo: DPoS.cs Proyecto: wyk125/AElf
        private async Task BroadcastTransaction(Transaction tx)
        {
            if (tx == null)
            {
                throw new ArgumentException(nameof(tx));
            }

            if (tx.Type == TransactionType.DposTransaction)
            {
                MessageHub.Instance.Publish(new DPoSTransactionGenerated(tx.GetHash().DumpHex()));
                _logger?.Trace(
                    $"A DPoS tx has been generated: {tx.GetHash().DumpHex()} - {tx.MethodName} from {tx.From.DumpHex()}.");
            }

            if (tx.From.Equals(_nodeKeyPair.Address))
            {
                _logger?.Trace(
                    $"Try to insert DPoS transaction to pool: {tx.GetHash().DumpHex()} " +
                    $"threadId: {Thread.CurrentThread.ManagedThreadId}");
            }
            await _txHub.AddTransactionAsync(tx, true);
        }