private async void AttachedNode_MessageReceivedAsync(Node node, IncomingMessage message)
        {
            try
            {
                if (message.Message.Payload is TxPayload txPayload)
                {
                    Transaction?.Invoke(this, new SmartTransaction(txPayload.Object, Height.Mempool));
                }
                else if (message.Message.Payload is BlockPayload blockPayload)
                {
                    Block?.Invoke(this, blockPayload.Object);
                }
                else if (message.Message.Payload is InvPayload invPayload)
                {
                    var getDataPayload = new GetDataPayload();
                    foreach (var inv in invPayload.Inventory)
                    {
                        if (inv.Type.HasFlag(InventoryType.MSG_TX))
                        {
                            TransactionInv?.Invoke(this, inv.Hash);
                            getDataPayload.Inventory.Add(inv);
                        }

                        if (inv.Type.HasFlag(InventoryType.MSG_BLOCK))
                        {
                            BlockInv?.Invoke(this, inv.Hash);
                            getDataPayload.Inventory.Add(inv);
                        }
                    }

                    if (getDataPayload.Inventory.Any() && node.IsConnected)
                    {
                        // ask for the whole transaction
                        await node.SendMessageAsync(getDataPayload).ConfigureAwait(false);
                    }
                }
            }
            catch (OperationCanceledException ex)
            {
                Logger.LogDebug(ex);
            }
            catch (Exception ex)
            {
                Logger.LogInfo($"Ignoring {ex.GetType()}: {ex.Message}");
                Logger.LogDebug(ex);
            }
        }
        private async void AttachedNode_MessageReceivedAsync(Node node, IncomingMessage message)
        {
            try
            {
                if (message.Message.Payload is InvPayload invPayload)
                {
                    var payload = new GetDataPayload();
                    foreach (var inv in invPayload.Inventory)
                    {
                        if (inv.Type.HasFlag(InventoryType.MSG_TX))
                        {
                            TransactionInv?.Invoke(this, inv.Hash);
                            payload.Inventory.Add(inv);
                        }
                        else if (inv.Type.HasFlag(InventoryType.MSG_BLOCK))
                        {
                            BlockInv?.Invoke(this, inv.Hash);
                            payload.Inventory.Add(inv);
                        }
                    }

                    if (payload.Inventory.Any() && node.IsConnected)
                    {
                        // ask for the whole transaction
                        await node.SendMessageAsync(payload);
                    }
                }
                else if (message.Message.Payload is TxPayload txPayload)
                {
                    Transaction?.Invoke(this, txPayload.Object);
                }
                else if (message.Message.Payload is BlockPayload blockPayload)
                {
                    Block?.Invoke(this, blockPayload.Object);
                }
            }
            catch (OperationCanceledException ex)
            {
                Logger.LogDebug <TrustedNodeNotifyingBehavior>(ex);
            }
            catch (Exception ex)
            {
                Logger.LogInfo <TrustedNodeNotifyingBehavior>($"Ignoring {ex.GetType()}: {ex.Message}");
                Logger.LogDebug <TrustedNodeNotifyingBehavior>(ex);
            }
        }