Exemplo n.º 1
0
            void AttachedNode_MessageReceived(Node node, IncomingMessage message)
            {
                TxPayload txPayload = message.Message.Payload as TxPayload;

                if (txPayload != null)
                {
                    Transaction tx;
                    var         hash = txPayload.Object.GetHash();
                    if (_Wallet._BroadcastedTransaction.TryRemove(hash, out tx))
                    {
                        _Broadcasting.TryRemove(hash, out tx);
                        _Wallet.OnTransactionBroadcasted(tx, node);
                    }
                }
                RejectPayload reject = message.Message.Payload as RejectPayload;

                if (reject != null)
                {
                    Transaction tx;
                    if (_Broadcasting.TryRemove(reject.Hash, out tx))
                    {
                        _Wallet.OnTransactionRejected(tx, node);
                    }
                }

                GetDataPayload getData = message.Message.Payload as GetDataPayload;

                if (getData != null)
                {
                    foreach (var inventory in getData.Inventory.Where(i => i.Type == InventoryType.MSG_TX))
                    {
                        Transaction tx;
                        if (_Broadcasting.TryRemove(inventory.Hash, out tx))
                        {
                            node.SendMessageAsync(new TxPayload(tx));
                        }
                    }
                }
            }
Exemplo n.º 2
0
 void _Broadcast_TransactionBroadcasted(Transaction transaction)
 {
     _Wallet.OnTransactionBroadcasted(transaction);
 }