Ejemplo n.º 1
0
 public HomeController(BlockQuery blockQuery, TransactionQuery txQuery, RedisCommand redisCommand, StatQuery statQuery)
 {
     _blockQuery   = blockQuery;
     _txQuery      = txQuery;
     _redisCommand = redisCommand;
     _statQuery    = statQuery;
 }
Ejemplo n.º 2
0
 public AddressStatsJob(ILogger <AddressStatsJob> logger, RedisCommand redisCommand, AddressQuery addressQuery, BlockQuery blockQuery, NexusQuery nexusQuery)
     : base(30, logger)
 {
     _redisCommand = redisCommand;
     _addressQuery = addressQuery;
     _blockQuery   = blockQuery;
     _nexusQuery   = nexusQuery;
 }
Ejemplo n.º 3
0
 public BlockScanJob(ILogger <BlockScanJob> logger, NexusQuery nexusQuery, BlockQuery blockQuery, BlockInsertCommand blockInsert,
                     AddressAggregatorCommand addressAggregator, BlockDeleteCommand blockDelete)
     : base(3, logger)
 {
     _nexusQuery        = nexusQuery;
     _blockQuery        = blockQuery;
     _blockInsert       = blockInsert;
     _addressAggregator = addressAggregator;
     _blockDelete       = blockDelete;
 }
Ejemplo n.º 4
0
 public TrustAddressCacheJob(ILogger <TrustAddressCacheJob> logger, NexusQuery nexusQuery, BlockQuery blockQuery,
                             NexusDb nexusDb, AddressQuery addressQuery, RedisCommand redisCommand)
     : base(180, logger)
 {
     _nexusQuery   = nexusQuery;
     _blockQuery   = blockQuery;
     _nexusDb      = nexusDb;
     _addressQuery = addressQuery;
     _redisCommand = redisCommand;
 }
Ejemplo n.º 5
0
 public BlockSyncJob(ILogger <BlockSyncJob> logger, NexusQuery nexusQuery, BlockQuery blockQuery, BlockPublishCommand blockPublish,
                     BlockInsertCommand blockInsert, AddressAggregatorCommand addressAggregator, BlockCacheCommand cacheCommand)
     : base(3, logger)
 {
     _nexusQuery        = nexusQuery;
     _blockQuery        = blockQuery;
     _blockPublish      = blockPublish;
     _blockInsert       = blockInsert;
     _addressAggregator = addressAggregator;
     _cacheCommand      = cacheCommand;
 }
Ejemplo n.º 6
0
 public AddressesController(UserManager <ApplicationUser> userManager, AddressQuery addressQuery, CurrencyQuery currencyQuery,
                            ExchangeQuery exchangeQuery, BlockQuery blockQuery, UserQuery userQuery, TransactionQuery transactionQuery)
 {
     _userManager      = userManager;
     _addressQuery     = addressQuery;
     _currencyQuery    = currencyQuery;
     _exchangeQuery    = exchangeQuery;
     _blockQuery       = blockQuery;
     _userQuery        = userQuery;
     _transactionQuery = transactionQuery;
 }
Ejemplo n.º 7
0
        public IActionResult Get(int index)
        {
            BlockApiModel block = BlockQuery.Get(index);

            if (block != null)
            {
                return(AsJson(block));
            }

            return(NotFound($"Block with index {index} is not found"));
        }
Ejemplo n.º 8
0
 public BlockSyncCatchup(NexusQuery nexusQuery, IServiceProvider serviceProvider, BlockQuery blockQuery,
                         ILogger <BlockSyncCatchup> logger, RedisCommand redisCommand, BlockInsertCommand blockInsert, BlockCacheCommand cacheCommand)
 {
     _nexusQuery        = nexusQuery;
     _serviceProvider   = serviceProvider;
     _blockQuery        = blockQuery;
     _logger            = logger;
     _redisCommand      = redisCommand;
     _blockInsert       = blockInsert;
     _cacheCommand      = cacheCommand;
     _cancelBlockStream = new CancellationTokenSource();
 }
        public ObjectResult Get(string id)
        {
            logger.LogDebug("Consuntado último bloque");
            var query = new BlockQuery(node.Blockchain);
            var block = query.Execute(Base58.Decode(id));

            if (block == null)
            {
                return(NotFound("No tengo ningún bloque con ese hash"));
            }

            return(Ok(block));
        }
Ejemplo n.º 10
0
        /// <summary>
        /// get event information
        /// </summary>
        /// <param name="blockHash">block hash</param>
        /// <returns>the event information</returns>
        public EventInfoResponse GetEventData(string blockHash)
        {
            var query = new BlockQuery()
            {
                Hash = blockHash
            };
            var response = client.getEventByHash(query);

            if (response.Error != null)
            {
                throw new RClientException(response.Error.Messages.ToString());
            }
            return(response);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// get the block information using block hash
        /// </summary>
        /// <param name="blockHash">block hash</param>
        /// <returns>block information</returns>
        public BlockInfo ShowBlock(string blockHash)
        {
            var blockQuery = new BlockQuery()
            {
                Hash = blockHash
            };
            var response = client.getBlock(blockQuery);

            //CheckResponse(response);
            if (response.Error != null)
            {
                throw new RClientException(response.Error.Messages.ToString());
            }
            return(response.BlockInfo);
        }
Ejemplo n.º 12
0
        public IActionResult GetBlocks(int fromIndex, int count)
        {
            if (count < 0)
            {
                return(BadRequest("'count' must be positive."));
            }

            if (fromIndex < 0)
            {
                fromIndex = 0;
            }

            List <BlockApiModel> result = BlockQuery.GetBlocks(fromIndex, count);

            return(Ok(result));
        }
Ejemplo n.º 13
0
 private void AssertBlockNotEmpty(BlockQuery block)
 {
     Assert.True(block.Block.Header.Height > 0);
     Assert.NotNull(block.Block.Header.Version);
     Assert.NotNull(block.Block.Header.AppHash);
     Assert.NotNull(block.Block.Header.ChainId);
     Assert.NotNull(block.Block.Header.ConsensusHash);
     Assert.NotNull(block.Block.Header.DataHash);
     Assert.NotNull(block.Block.Header.EvidenceHash);
     Assert.NotNull(block.Block.Header.ProposerAddress);
     Assert.NotNull(block.Block.Header.ValidatorsHash);
     Assert.NotNull(block.Block.Header.LastBlockId.Hash);
     Assert.NotNull(block.Block.Header.LastBlockId.Parts.Hash);
     Assert.NotNull(block.Block.Header.LastCommitHash);
     Assert.NotNull(block.Block.Header.LastResultsHash);
     Assert.NotNull(block.Block.Header.NextValidatorsHash);
 }
Ejemplo n.º 14
0
        public BlockSyncFixture()
        {
            var sc = new ServiceCollection();

            Settings.BuildConfig(sc);
            Settings.AttachConfig(sc.BuildServiceProvider(), true);

            var testDb = new NexusTestDesignTimeDbContextFactory().CreateDbContext(null);

            Client            = new NxsClient(Settings.Connection.Nexus);
            InsertCommand     = new BlockInsertCommand();
            DeleteCommand     = new BlockDeleteCommand();
            AddressAggregator = new AddressAggregatorCommand();
            Mapper            = new AutoMapperConfig().GetMapper();
            NexusQuery        = new NexusQuery(Client, Mapper);
            BlockQuery        = new BlockQuery(testDb, Mapper);
            AddressQuery      = new AddressQuery(testDb, null);
        }
Ejemplo n.º 15
0
        public void ReadBlock(BlockQuery block, int x, int y, int z)
        {
            int chunkX = x, chunkY = y, chunkZ = z;

            VoxelChunk.ConvertWorldToChunk(ref chunkX, ref chunkY, ref chunkZ);
            var   chunk = GetChunk(chunkX, chunkY, chunkZ);
            Voxel voxel;

            if (chunk != null)
            {
                VoxelChunk.ConvertWorldToLocal(ref x, ref y, ref z);
                voxel = chunk.GetVoxel(x, y, z);
            }
            else
            {
                voxel = new Voxel();
            }

            //TODO: Properly query for core voxel if current voxel.IsPointer
            block.Set(voxel, chunk, x, y, z);
        }
Ejemplo n.º 16
0
 public BlockRewardCatchup(ILogger <BlockRewardCatchup> logger, NexusDb nexusDb, BlockQuery blockQuery)
 {
     _logger     = logger;
     _nexusDb    = nexusDb;
     _blockQuery = blockQuery;
 }
Ejemplo n.º 17
0
 public TransactionsController(BlockQuery blockQuery, TransactionQuery transactionQuery)
 {
     _blockQuery       = blockQuery;
     _transactionQuery = transactionQuery;
 }
Ejemplo n.º 18
0
        public List <BlockSyncApiModel> GetBlocksForSync(int fromIndex, int count)
        {
            List <BlockSyncApiModel> blocks = BlockQuery.GetBlocksForSync(fromIndex, count);

            return(blocks);
        }
Ejemplo n.º 19
0
        public IActionResult GettAllBlocks()
        {
            List <BlockApiModel> lastBlock = BlockQuery.GetAllBlocks();

            return(Ok(lastBlock));
        }
Ejemplo n.º 20
0
 public BlocksController(BlockQuery blockQuery, BlockCacheCommand cacheCommand)
 {
     _blockQuery   = blockQuery;
     _cacheCommand = cacheCommand;
 }
Ejemplo n.º 21
0
        public IActionResult Get()
        {
            List <BlockSyncApiModel> blocks = BlockQuery.All();

            return(AsJson(blocks));
        }
Ejemplo n.º 22
0
 public LayoutHub(RedisCommand redisCommand, BlockQuery blockQuery, ExchangeQuery exchangeQuery)
 {
     _redisCommand  = redisCommand;
     _blockQuery    = blockQuery;
     _exchangeQuery = exchangeQuery;
 }
Ejemplo n.º 23
0
 public BlockCacheCommand(RedisCommand redisCommand, BlockQuery blockQuery)
 {
     _redisCommand = redisCommand;
     _blockQuery   = blockQuery;
 }
Ejemplo n.º 24
0
        public IActionResult GetLastBlock(int count)
        {
            List <BlockApiModel> lastBlock = BlockQuery.GetLastBlocks(count);

            return(Ok(lastBlock));
        }
Ejemplo n.º 25
0
 public AddressAggregateCatchup(ILogger <AddressAggregateCatchup> logger, BlockQuery blockQuery, AddressAggregatorCommand addressAggregator)
 {
     _logger            = logger;
     _blockQuery        = blockQuery;
     _addressAggregator = addressAggregator;
 }