public void Init() { var model = ExplorerDomain.Get <DataStatisticsModel>(ExplorerSetting.DataStatistics); if (model == null) { Height = -1; return; } TotalAmount = model.TotalAmount; lockedUtxosets = UtxoSetDac.Default.Get(model.lockedUtxoSets).ToList(); accountAmounts = model.AccountsInfo; Height = model.BlockHeight; }
public void UpdateDb(long blockHeight) { var localTime = Time.EpochTime; lockedUtxosets.RemoveAll(x => x.IsConfirmed(blockHeight) && x.Locktime < localTime); DataStatisticsModel model = new DataStatisticsModel(); model.AccountsInfo = accountAmounts; model.TotalAmount = TotalAmount; model.lockedUtxoSets = lockedUtxosets.Select(x => $"{x.TransactionHash}_{x.Index}").ToList(); model.BlockHeight = blockHeight; ExplorerDomain.Put(ExplorerSetting.DataStatistics, model); }