private bool BlockAccount(ApplicationEngine engine, UInt160 account) { if (!CheckCommittees(engine)) { return(false); } StorageKey key = CreateStorageKey(Prefix_BlockedAccounts); StorageItem storage = engine.Snapshot.Storages[key]; List <UInt160> accounts = storage.GetSerializableList <UInt160>(); if (accounts.Contains(account)) { return(false); } engine.Snapshot.Storages.GetAndChange(key); accounts.Add(account); return(true); }
private bool UnblockAccount(ApplicationEngine engine, UInt160 account) { if (!CheckCommittee(engine)) { return(false); } StorageKey key = CreateStorageKey(Prefix_BlockedAccounts); StorageItem storage = engine.Snapshot.Storages.TryGet(key); if (storage is null) { return(false); } List <UInt160> accounts = storage.GetSerializableList <UInt160>(); int index = accounts.IndexOf(account); if (index < 0) { return(false); } engine.Snapshot.Storages.GetAndChange(key); accounts.RemoveAt(index); return(true); }