private void Check(PeerConnection peer, FetchInventoryDataMessage message)
        {
            MessageTypes.MsgType type = message.InventoryMessageType;

            if (type == MessageTypes.MsgType.TX)
            {
                foreach (SHA256Hash hash in message.GetHashList())
                {
                    if (peer.GetInventorySpread(new Item(hash, InventoryType.Trx)) == null)
                    {
                        throw new P2pException(P2pException.ErrorType.BAD_MESSAGE, "not spread inventory : " + hash);
                    }
                }

                int fetch_count = peer.NodeStatistics.MessageStatistics.MineralInTrxFetchInvDataElement.GetCount(10);
                int max_count   = Manager.Instance.AdvanceService.TxCount.GetCount(60);
                if (fetch_count > max_count)
                {
                    throw new P2pException(
                              P2pException.ErrorType.BAD_MESSAGE, "maxCount: " + max_count + ", fetchCount: " + fetch_count);
                }
            }
            else
            {
                bool is_advance = true;
                foreach (SHA256Hash hash in message.GetHashList())
                {
                    if (peer.GetInventorySpread(new Item(hash, InventoryType.Block)) == null)
                    {
                        is_advance = false;
                        break;
                    }
                }

                if (is_advance)
                {
                    MessageCount out_advance_block = peer.NodeStatistics.MessageStatistics.MineralOutAdvBlock;
                    out_advance_block.Add(message.GetHashList().Count);

                    int out_block_count_1min = out_advance_block.GetCount(60);
                    int produced_block_2min  = 120000 / Parameter.ChainParameters.BLOCK_PRODUCED_INTERVAL;
                    if (out_block_count_1min > produced_block_2min)
                    {
                        throw new P2pException(
                                  P2pException.ErrorType.BAD_MESSAGE,
                                  "producedBlockIn2min: " + produced_block_2min + ", outBlockCountIn1min: " + out_block_count_1min);
                    }
                }
                else
                {
                    if (!peer.IsNeedSyncUs)
                    {
                        throw new P2pException(
                                  P2pException.ErrorType.BAD_MESSAGE, "no need sync");
                    }

                    foreach (SHA256Hash hash in message.GetHashList())
                    {
                        long block_num     = new BlockId(hash).Num;
                        long min_block_num = peer.LastSyncBlockId.Num - 2 * Parameter.NodeParameters.SYNC_FETCH_BATCH_NUM;

                        if (block_num < min_block_num)
                        {
                            throw new P2pException(
                                      P2pException.ErrorType.BAD_MESSAGE, "minBlockNum: " + min_block_num + ", blockNum: " + block_num);
                        }

                        if (peer.GetSyncBlockId(hash) != null)
                        {
                            throw new P2pException(
                                      P2pException.ErrorType.BAD_MESSAGE, new BlockId(hash).GetString() + " is exist");
                        }

                        peer.AddSyncBlockId(hash, Helper.CurrentTimeMillis());
                    }
                }
            }
        }