Esempio n. 1
0
        public void SetTxState(TxState state)
        {
            if (state == null)
            {
                return;
            }

            lock (listTxlock)
            {
                var results = transactions.Where(x => x.hash == state.hash).ToList();
                if (results.Count > 0)
                {
                    var oldstate = results[0];
                    oldstate.height   = state.height;
                    oldstate.time     = state.time;
                    oldstate.position = state.position;
                    oldstate.size     = state.size;
                    oldstate.offset   = state.offset;
                }
                else
                {
                    transactions.Add(state);
                }
            }
        }
Esempio n. 2
0
        private void StoreTxState(uint blocktime, uint height, DecodeRawTransactionResponse txraw, RawTransactionResponse tx,
                                  uint index, long offset, uint rawsize)
        {
            var time = blocktime < PeercoinConstants.ProtocolV10SwitchTime && txraw.time.HasValue
                                ? (uint)txraw.time.Value
                                : blocktime;

            var state = new TxState {
                hash     = txraw.txid,
                height   = height,
                offset   = (uint)offset,
                position = index,
                size     = rawsize,
                time     = (uint)txraw.time.Value
            };

            transactionRepository.SetTxState(state);
        }