Пример #1
0
        public void UpdateLocalStateRoot(uint height, List <DataCache.Trackable> change_set)
        {
            using StateSnapshot state_snapshot = Singleton.GetSnapshot();
            foreach (var item in change_set)
            {
                switch (item.State)
                {
                case TrackState.Added:
                    state_snapshot.Trie.Put(item.Key, item.Item);
                    break;

                case TrackState.Changed:
                    state_snapshot.Trie.Put(item.Key, item.Item);
                    break;

                case TrackState.Deleted:
                    state_snapshot.Trie.Delete(item.Key);
                    break;
                }
            }
            UInt256   root_hash  = state_snapshot.Trie.Root.Hash;
            StateRoot state_root = new StateRoot
            {
                Index    = height,
                RootHash = root_hash,
                Witness  = null,
            };

            state_snapshot.AddLocalStateRoot(state_root);
            state_snapshot.Commit();
            UpdateCurrentSnapshot();
            CheckValidatedStateRoot(height);
        }
Пример #2
0
 public void UpdateLocalStateRoot(uint height)
 {
     _state_snapshot?.Commit();
     _state_snapshot = null;
     UpdateCurrentSnapshot();
     system.Verifier?.Tell(new VerificationService.BlockPersisted {
         Index = height
     });
     CheckValidatedStateRoot(height);
 }