示例#1
0
        public (int, int, string) GetLastBlockLevel()
        {
            lock (_dbLock)
            {
                if (lastBlock == null)
                {
                    lastBlock = _db.LastBlock.SingleOrDefault();
                }
                if (lastBlock == null)
                {
                    lastBlock = new LastBlock {
                        Level = 0
                    };
                    _db.LastBlock.Add(lastBlock);
                    _db.SaveChanges();
                }

                return(lastBlock.Level, lastBlock.Priority, lastBlock.Hash);
            }
        }
示例#2
0
 public void SaveMessage(Message message)
 {
     using var db = new TezosDataContext(_dbOptions);
     db.Add(message);
     db.SaveChanges();
 }