Exemplo n.º 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);
        }
Exemplo n.º 2
0
 public void Put(uint256 txId, Transaction tx)
 {
     _Repository.Put(GetId(txId), tx);
 }