当前位置: 首页>>代码示例>>C#>>正文


C# uint256.ToString方法代码示例

本文整理汇总了C#中NBitcoin.uint256.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# uint256.ToString方法的具体用法?C# uint256.ToString怎么用?C# uint256.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在NBitcoin.uint256的用法示例。


在下文中一共展示了uint256.ToString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetHeader

 public BlockHeader GetHeader(uint256 hash)
 {
     var pos = _Index.Get<DiskBlockPos>(hash.ToString());
     if(pos == null)
         return null;
     var stored = _Store.Enumerate(false, new DiskBlockPosRange(pos)).FirstOrDefault();
     if(stored == null)
         return null;
     return stored.Item.Header;
 }
开发者ID:royosherove,项目名称:NBitcoin,代码行数:10,代码来源:IndexedBlockStore.cs

示例2: GetBlock

        public Block GetBlock(uint256 blockId)
        {
            var ms = new MemoryStream();
            var container = Configuration.GetBlocksContainer();
            try
            {

                container.GetPageBlobReference(blockId.ToString()).DownloadToStream(ms);
                ms.Position = 0;
                Block b = new Block();
                b.ReadWrite(ms, false);
                return b;
            }
            catch(StorageException ex)
            {
                if(ex.RequestInformation != null && ex.RequestInformation.HttpStatusCode == 404)
                {
                    return null;
                }
                throw;
            }
        }
开发者ID:bijakatlykkex,项目名称:NBitcoin.Indexer,代码行数:22,代码来源:IndexerClient.cs

示例3: GetTransactionAsync

        public async Task<TransactionEntry> GetTransactionAsync(bool loadPreviousOutput, bool fetchColor, uint256 txId)
        {
            if(txId == null)
                return null;
            TransactionEntry result = null;

            var table = Configuration.GetTransactionTable();
            var searchedEntity = new TransactionEntry.Entity(txId);
            var query = new TableQuery()
                            .Where(
                                    TableQuery.CombineFilters(
                                        TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, searchedEntity.PartitionKey),
                                        TableOperators.And,
                                        TableQuery.CombineFilters(
                                            TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.GreaterThan, txId.ToString() + "-"),
                                            TableOperators.And,
                                            TableQuery.GenerateFilterCondition("RowKey", QueryComparisons.LessThan, txId.ToString() + "|")
                                        )
                                  ));
            query.TakeCount = 10; //Should not have more
            List<TransactionEntry.Entity> entities = new List<TransactionEntry.Entity>();
            foreach(var e in await table.ExecuteQuerySegmentedAsync(query, null).ConfigureAwait(false))
            {
                if(e.IsFat())
                    entities.Add(new TransactionEntry.Entity(await FetchFatEntity(e).ConfigureAwait(false)));
                else
                    entities.Add(new TransactionEntry.Entity(e));
            }
            if(entities.Count == 0)
                result = null;
            else
            {
                result = new TransactionEntry(entities.ToArray());
                if(result.Transaction == null)
                {
                    foreach(var block in result.BlockIds.Select(id => GetBlock(id)).Where(b => b != null))
                    {
                        result.Transaction = block.Transactions.FirstOrDefault(t => t.GetHash() == txId);
                        entities[0].Transaction = result.Transaction;
                        if(entities[0].Transaction != null)
                        {
                            await UpdateEntity(table, entities[0].CreateTableEntity()).ConfigureAwait(false);
                        }
                        break;
                    }
                }

                if(fetchColor && result.ColoredTransaction == null)
                {
                    result.ColoredTransaction = await ColoredTransaction.FetchColorsAsync(txId, result.Transaction, new CachedColoredTransactionRepository(new IndexerColoredTransactionRepository(Configuration))).ConfigureAwait(false);
                    entities[0].ColoredTransaction = result.ColoredTransaction;
                    if(entities[0].ColoredTransaction != null)
                    {
                        await UpdateEntity(table, entities[0].CreateTableEntity()).ConfigureAwait(false);
                    }
                }
                var needTxOut = result.SpentCoins == null && loadPreviousOutput && result.Transaction != null;
                if(needTxOut)
                {
                    var inputs = result.Transaction.Inputs.Select(o => o.PrevOut).ToArray();
                    var parents = await
                            GetTransactionsAsync(false, false, inputs
                             .Select(i => i.Hash)
                             .ToArray()).ConfigureAwait(false);

                    for(int i = 0; i < parents.Length; i++)
                    {
                        if(parents[i] == null)
                        {
                            IndexerTrace.MissingTransactionFromDatabase(result.Transaction.Inputs[i].PrevOut.Hash);
                            return null;
                        }
                    }

                    var outputs = parents.Select((p, i) => p.Transaction.Outputs[inputs[i].N]).ToArray();

                    result.SpentCoins = Enumerable
                                            .Range(0, inputs.Length)
                                            .Select(i => new Spendable(inputs[i], outputs[i]))
                                            .ToList();
                    entities[0].PreviousTxOuts.Clear();
                    entities[0].PreviousTxOuts.AddRange(outputs);
                    if(entities[0].IsLoaded)
                    {
                        await UpdateEntity(table, entities[0].CreateTableEntity()).ConfigureAwait(false);
                    }
                }
            }
            return result != null && result.Transaction != null ? result : null;
        }
开发者ID:bijakatlykkex,项目名称:NBitcoin.Indexer,代码行数:90,代码来源:IndexerClient.cs

示例4: GetId

		private string GetId(uint256 txId)
		{
			return "tx-" + txId.ToString();
		}
开发者ID:crowar,项目名称:NBitcoin,代码行数:4,代码来源:NoSqlTransactionRepository.cs

示例5: GetCoins

 public Coins GetCoins(uint256 txId)
 {
     return Index.Get<Coins>(txId.ToString());
 }
开发者ID:nikropht,项目名称:NBitcoin,代码行数:4,代码来源:CoinsView.cs

示例6: SetCoins

 public void SetCoins(uint256 txId, Coins coins)
 {
     Index.Put(txId.ToString(), coins);
 }
开发者ID:nikropht,项目名称:NBitcoin,代码行数:4,代码来源:CoinsView.cs

示例7: PutAsync

		public Task PutAsync(uint256 blockId, Block block)
		{
			return _Repository.PutAsync(blockId.ToString(), block);
		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:4,代码来源:NoSqlBlockRepository.cs

示例8: GetBlockAsync

		public Task<Block> GetBlockAsync(uint256 blockId)
		{
			return _Repository.GetAsync<Block>(blockId.ToString());
		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:4,代码来源:NoSqlBlockRepository.cs


注:本文中的NBitcoin.uint256.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。