コード例 #1
0
ファイル: Blockchain.cs プロジェクト: jscoop2k/neo
        protected override void OnReceive(object message)
        {
            switch (message)
            {
            case Import import:
                OnImport(import.Blocks, import.Verify);
                break;

            case FillMemoryPool fill:
                OnFillMemoryPool(fill.Transactions);
                break;

            case Block block:
                OnInventory(block, false);
                break;

            case Transaction[] transactions:
            {
                // This message comes from a mempool's revalidation, already relayed
                foreach (var tx in transactions)
                {
                    OnInventory(tx, false);
                }
                break;
            }

            case IInventory inventory:
                OnInventory(inventory);
                break;

            case Idle _:
                if (MemPool.ReVerifyTopUnverifiedTransactionsIfNeeded(MaxTxToReverifyPerIdle, currentSnapshot))
                {
                    Self.Tell(Idle.Instance, ActorRefs.NoSender);
                }
                break;
            }
        }
コード例 #2
0
        protected override void OnReceive(object message)
        {
            switch (message)
            {
            case Import import:
                OnImport(import.Blocks);
                break;

            case FillMemoryPool fill:
                OnFillMemoryPool(fill.Transactions);
                break;

            case Header[] headers:
                OnNewHeaders(headers);
                break;

            case Block block:
                Sender.Tell(OnNewBlock(block));
                break;

            case Transaction transaction:
                Sender.Tell(OnNewTransaction(transaction));
                break;

            case ConsensusPayload payload:
                Sender.Tell(OnNewConsensus(payload));
                break;

            case Idle _:
                if (MemPool.ReVerifyTopUnverifiedTransactionsIfNeeded(MaxTxToReverifyPerIdle, currentSnapshot))
                {
                    Self.Tell(Idle.Instance, ActorRefs.NoSender);
                }
                break;
            }
        }