예제 #1
0
        public void PutStorageValue(byte[] address, DataWord key, DataWord value)
        {
            address = Wallet.ToAddAddressPrefix(address);
            if (GetAccount(address) != null)
            {
                Key       address_key = new Key(address);
                VMStorage storage     = null;

                if (this.storage_cache.ContainsKey(address_key))
                {
                    storage = this.storage_cache[address_key];
                }
                else
                {
                    storage = GetStorage(address);
                    this.storage_cache.Add(address_key, storage);
                }
                storage.Put(key, value);
            }
        }
예제 #2
0
        public DataWord GetStorageValue(byte[] address, DataWord key)
        {
            DataWord result = null;

            address = Wallet.ToAddAddressPrefix(address);
            if (GetAccount(address) != null)
            {
                Key       address_key = new Key(address);
                VMStorage storage     = null;

                if (this.storage_cache.ContainsKey(address_key))
                {
                    storage = this.storage_cache[address_key];
                }
                else
                {
                    storage = GetStorage(address);
                    this.storage_cache.Add(address_key, storage);
                }
                result = storage.Get(key);
            }

            return(result);
        }
예제 #3
0
        public VMStorage GetStorage(byte[] address)
        {
            VMStorage result = null;
            Key       key    = new Key(address);

            if (this.storage_cache.ContainsKey(key))
            {
                result = this.storage_cache[key];
            }
            else
            {
                if (this.parent != null)
                {
                    VMStorage parent_storage = this.parent.GetStorage(address);
                    result = VMConfig.EnergyLimitHardFork ? new VMStorage(parent_storage) : parent_storage;
                }
                else
                {
                    result = new VMStorage(address, this.db_manager.StorageRow);
                }
            }

            return(result);
        }
예제 #4
0
 public void PutStorage(Key key, VMStorage cache)
 {
     this.storage_cache.Put(key, cache);
 }