示例#1
0
func (self *StateObject) GetState(key common.Hash) common.Hash {
	strkey := key.Str()
	value, exists := self.storage[strkey]
	if !exists {
		value = self.getAddr(key)
		if (value != common.Hash{}) {
			self.storage[strkey] = value
		}
	}

	return value
}
示例#2
0
func (self *StateObject) GetState(key common.Hash) *common.Value {
	strkey := key.Str()
	value := self.storage[strkey]
	if value == nil {
		value = self.getAddr(key)

		if !value.IsNil() {
			self.storage[strkey] = value
		}
	}

	return value
}
示例#3
0
// GetState returns the storage value at the given address from either the cache
// or the trie
func (self *StateObject) GetState(ctx context.Context, key common.Hash) (common.Hash, error) {
	strkey := key.Str()
	value, exists := self.storage[strkey]
	if !exists {
		var err error
		value, err = self.getAddr(ctx, key)
		if err != nil {
			return common.Hash{}, err
		}
		if (value != common.Hash{}) {
			self.storage[strkey] = value
		}
	}

	return value, nil
}
示例#4
0
func (self *StateObject) SetState(k, value common.Hash) {
	self.storage[k.Str()] = value
	self.dirty = true
}
示例#5
0
func (self *StateObject) SetState(k common.Hash, value *common.Value) {
	self.storage[k.Str()] = value.Copy()
	self.dirty = true
}