示例#1
0
        public int ReIndex()
        {
            var last  = _Index.Get <DiskBlockPos>(IndexedLimit);
            int count = 0;
            List <StoredBlock> lastBlocks = null;

            foreach (var blocks in _Store.Enumerate(true, new DiskBlockPosRange(last)).Partition(400))
            {
                count += blocks.Count;
                _Index.PutBatch(blocks.Select(b => new Tuple <String, IBitcoinSerializable>(b.Item.GetHash().ToString(), b.BlockPosition)));
                lastBlocks = blocks;
            }
            if (lastBlocks != null && lastBlocks.Count > 0)
            {
                var block = lastBlocks.Last();
                _Index.Put(IndexedLimit, new DiskBlockPos(block.BlockPosition.File, block.BlockPosition.Position + (uint)block.GetStorageSize()));
            }
            return(count);
        }
示例#2
0
 public Transaction Get(uint256 txId)
 {
     return(_Repository.Get <Transaction>(GetId(txId)));
 }