コード例 #1
0
        private void LocalNode_InventoryReceiving(object sender, InventoryReceivingEventArgs e)
        {
            Transaction tx = e.Inventory as Transaction;

            if (tx != null)
            {
                lock (context)
                {
                    if (!context.State.HasFlag(ConsensusState.Backup) || !context.State.HasFlag(ConsensusState.RequestReceived) || context.State.HasFlag(ConsensusState.SignatureSent) || context.State.HasFlag(ConsensusState.ViewChanging))
                    {
                        return;
                    }
                    if (context.Transactions.ContainsKey(tx.Hash))
                    {
                        return;
                    }
                    if (!context.TransactionHashes.Contains(tx.Hash))
                    {
                        return;
                    }
                    AddTransaction(tx, true);
                    e.Cancel = true;
                }
            }
        }
コード例 #2
0
        private void LocalNode_InventoryReceiving(object sender, InventoryReceivingEventArgs e)
        {
            ReportNeoBlockchain reportObj = new ReportNeoBlockchain("[NeoConsensusService-LocalNode_InventoryReceiving]");

            Transaction tx = e.Inventory as Transaction;

            if (tx != null)
            {
                lock (context)
                {
                    if (!context.State.HasFlag(ConsensusState.Backup) || !context.State.HasFlag(ConsensusState.RequestReceived) || context.State.HasFlag(ConsensusState.SignatureSent) || context.State.HasFlag(ConsensusState.ViewChanging))
                    {
                        return;
                    }
                    if (context.Transactions.ContainsKey(tx.Hash))
                    {
                        return;
                    }
                    if (!context.TransactionHashes.Contains(tx.Hash))
                    {
                        return;
                    }
                    AddTransaction(tx, true);
                    e.Cancel = true;
                }
            }

            reportObj.appendElapsedTime();
        }