private async Task InsertTransactionToPool(Transaction tx) { if (tx == null) { return; } // insert to tx pool and broadcast await _txHub.AddTransactionAsync(tx, skipValidation : true).ConfigureAwait(false); }
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(); }
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); }