Пример #1
0
        internal void Add <TransactionType>(long blockId, TransactionItem <TransactionType> item) where TransactionType : Operation
        {
            var transaction   = item.Transaction;
            var transactionId = transaction.OperationId;

            var split = TransactionSliceInfo.IsSliceSplit(transactionId);

            lock (_lock)
            {
                _transactionSlice.AddEntry(transactionId, item.ToByteArray());

                _currentBlockId = blockId;
                if (_currentFirsBlockId == Protocol.InvalidBlockId)
                {
                    _currentFirsBlockId = blockId;
                }

                _transactionSlice.FirstBlockId = _currentFirsBlockId;
                _transactionSlice.LastBlockId  = _currentBlockId;
                _transactionSlice.Split        = split;
            }

            if (split)
            {
                Save();
                Split(blockId);
            }
        }