}//end of public virtual async void OnNewTX(List<Transaction> txs)

        /// <summary>
        /// Fires Off a "New Block" Event
        /// </summary>
        /// <param name="blockNumber">Block #</param>
        public virtual async void OnNewBlock(ulong blockNumber)
        {
            GetBlockResponse blockData = await _RestClient.GetBlock(blockNumber);

            Guard.Null(blockData, nameof(blockData), $"Node '{Name}' ({Address}:{Port}) Detected A New Block @ Height '{blockNumber}' But GetBlock Returned NULL!");

            this.NewBlockEvent?.Invoke(this, new NewBlockEvent(blockData.ToBlockHeader()));
        } //end of public virtual void OnNewBlock(ulong blockNumber)
Example #2
0
        /// <summary>
        ///     Fires Off a "New Block" Event
        /// </summary>
        /// <param name="blockNumber">Block #</param>
        public async void OnNewBlock(ulong blockNumber)
        {
            try
            {
                GetBlockResponse blockData = await restClient.GetBlock(blockNumber);

                Guard.Null(blockData, nameof(blockData), $"Node '{Name}' ({Address}:{Port}) Detected A New Block @ Height '{blockNumber}' But GetBlock Returned NULL!");

                NewBlockEvent?.Invoke(this, new NewBlockEvent(blockData.ToBlockHeader()));
            }
            catch (Exception ex)
            {
                logger.LogDebug("Failed to call OnNewBlock()", ex);
            }
        }